ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Drawer

A drawer component for React.

About#

Drawer is built on top of Vaul by emilkowalski.

Installation#

npx shadcn@latest add @rescript-shadcn/Drawer

Usage#

<Drawer>
  <Drawer.Trigger asChild=true>
    <Button variant=Outline> {"Open Drawer"->React.string} </Button>
  </Drawer.Trigger>
  <Drawer.Content>
    <Drawer.Header>
      <Drawer.Title> {"Are you absolutely sure?"->React.string} </Drawer.Title>
      <Drawer.Description> {"This action cannot be undone."->React.string} </Drawer.Description>
    </Drawer.Header>
    <Drawer.Footer>
      <Button> {"Submit"->React.string} </Button>
      <Drawer.Close asChild=true>
        <Button variant=Outline> {"Cancel"->React.string} </Button>
      </Drawer.Close>
    </Drawer.Footer>
  </Drawer.Content>
</Drawer>

Examples#

Scrollable Content#

Keep actions visible while the content scrolls.

Sides#

Use the direction prop to set the side of the drawer. Available options are top, right, bottom, and left.

Responsive Dialog#

You can combine the Dialog and Drawer components to create a responsive dialog. This renders a Dialog component on desktop and a Drawer on mobile.

API Reference#

See the Vaul documentation for the full API reference.

@@directive("'use client'")

type drawerDatum = {goal: int}
@react.component
let make = () =>
  <Drawer direction=Right>
let sides = [Drawer.Top, Drawer.Right, Drawer.Bottom, Drawer.Left]

@react.component
@@directive("'use client'")

type browserWindow