AccessRequest
A notification pill with stacked avatars that grows into a list. Each avatar travels from the stack to its own row, then the name and Approve / Reject buttons fade in one by one.
Preview
Preview coming soon
Try it live: run the CLI command below in an Expo app, or open the Code tab.
Installation
npx @codewithrabby/ui@latest add access-requestUsage
import { AccessRequest } from "@/components/uir/access-request";
const [people, setPeople] = useState([
{ id: "1", name: "Louis Griffen", color: "#a855f7" },
{ id: "2", name: "Peter Griffen", color: "#ef4444", image: require("./peter.jpg") },
]);
const remove = (p) => setPeople((list) => list.filter((x) => x.id !== p.id));
{people.length > 0 && (
<AccessRequest
people={people}
onApprove={(p) => { approve(p.id); remove(p); }}
onReject={remove}
onDismiss={() => setPeople([])}
/>
)}Props
| Prop | Type | Default |
|---|---|---|
people{ id, name, color, image? }. The colour shows behind the initial when there's no image. | AccessRequestPerson[] | — |
titleHeader when open. | string | "Access Request" |
summaryFirst line when closed. | ReactNode | "<first> and N others" |
subtitleSecond line when closed. | string | "requested access" |
approveLabelApprove button label. | string | "Approve" |
rejectLabelReject button label. | string | "Reject" |
onApproveApprove pressed on a row. | (person) => void | — |
onRejectReject pressed on a row. | (person) => void | — |
onDismissShows the × button. Hide the component yourself when it's called. | () => void | — |
defaultOpenStart expanded. | boolean | false |
onOpenChangeCalled when the chevron is pressed. | (open: boolean) => void | — |
backgroundColorCard background. | string | "#141414" |