Calm motion: animations on this site only fade, with no movement
Share access
The people who can open a file, their access level, and the access for a link
Controls who can see and change a shared file. Put it in a modal behind a Share button. To send a link through the apps of the device, use the share bar.
Basic
People with access
- APAna Putriana@example.comOwner
- BSBudi Santosobudi@example.com
- SWSari Wulandarisari@example.com
General access
Only the people above can open it.
vue
<template>
<BlessShareAccess
v-model:people="people"
v-model:link-access="linkAccess"
link="https://example.com/docs/q4-plan"
@invite="invite"
/>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { BlessShareAccess, type BlessAccessRole, type BlessSharePerson } from "blessing-ui";
const people = ref<BlessSharePerson[]>([
{ id: "1", name: "Ana Putri", email: "ana@example.com", role: "owner" },
{ id: "2", name: "Budi Santoso", email: "budi@example.com", role: "edit" },
{ id: "3", name: "Sari Wulandari", email: "sari@example.com", role: "comment" },
]);
const linkAccess = ref<"restricted" | BlessAccessRole>("restricted");
const invite = (email: string, role: BlessAccessRole) =>
people.value.push({ id: email, name: email.split("@")[0]!, email, role });
</script>v-model:peopleis the list of people. Each person has anid, aname, an optionalemail, and arole.- The role is
view,comment, oredit. The roleownershows as text, and the owner cannot be changed or removed. - The form on top checks the email address with the browser. Invite emits
invitewith the address and the role. You add the person to the list. v-model:link-accessisrestrictedor a role. If it isrestricted, only the people on the list can open the file. Otherwise, anyone with the link gets that role. A line under the menus says the result in words.- If you set
link, a button copies it, and a status line says so. - Change the words with
labelsor a label pack. The API table lists the keys.
Usage
ts
import { BlessShareAccess } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
link | string | — | the link to the file, for the copy button |
labels | Partial<Record<BlessAccessRole | "owner", string> & { email: string; newRole: string; invite: string; people: string; remove: string; roleFor: (name: string) => string; removeFor: (name: string) => string; general: string; restricted: string; anyone: string; restrictedHint: string; anyoneHint: (role: string) => string; copy: string; copied: string; }> | — | |
people | BlessSharePerson[] | [] | |
linkAccess | "restricted" | BlessAccessRole | "restricted" | who can open the link: only the people on the list, or anyone with the link at this role |
Events
| Name | Payload | Description |
|---|---|---|
update:people | [value: BlessSharePerson[]] | |
update:linkAccess | [value: "restricted" | BlessAccessRole] | |
invite | [email: string, role: BlessAccessRole] |