DocsComponentsTemplatesThemesGitHub

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.json

Guidelines

  • 400px default (width to change). Header title + close; footer actions fill the width.

Props

PropTypeRequired
openbooleanYes
onClose() => voidNo
titleReact.ReactNodeYes
footerReact.ReactNodeNo
widthnumber | stringNo
containedbooleanNo
classNamestringNo
childrenReact.ReactNodeNo

Edit this example on GitHub