Drawer
Side sheet for details and edits without leaving the page; bottom sheet on phones.
Code
import * as React from 'react';
import { Badge, Button, Drawer, List, ListRow } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
position: 'relative',
height: 430,
borderRadius: 20,
overflow: 'hidden',
background: 'var(--bg)',
}}
>
<Drawer
open
contained
width={340}
{...{
onClose() {},
}}
title="Mobile onboarding"
footer={
<>
<Button variant="gray">Cancel</Button>
<Button>Save</Button>
</>
}
>
<List>
<ListRow title="Owner" value="Marco Kim" />
<ListRow
title="Status"
trailing={
<Badge tone="warning" dot>
Review
</Badge>
}
/>
<ListRow title="Due" value="Dec 12" />
</List>
</Drawer>
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Drawer } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/drawer.jsonGuidelines
- 400px default (
widthto change). Header title + close; footer actions fill the width.
Props
| Prop | Type | Required |
|---|---|---|
open | boolean | Yes |
onClose | () => void | No |
title | React.ReactNode | Yes |
footer | React.ReactNode | No |
width | number | string | No |
contained | boolean | No |
className | string | No |
children | React.ReactNode | No |