Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

Drawer

Drawer reuses Dialog behavior for focus, scroll locking, and dismissal. Pass a React element as trigger and content as children.

import { Button, Drawer, Input } from '@manti-ui/react';

export default function DrawerBasic() {
  return (
    <Drawer
      trigger={<Button variant="primary">Edit recipe</Button>}
      title="Edit recipe"
      description="Adjust the filling and the finish, then save."
      footer={({ close }) => (
        <>
          <Button variant="tertiary" onClick={close}>
            Cancel
          </Button>
          <Button variant="primary" onClick={close}>
            Save
          </Button>
        </>
      )}
    >
      <div className="grid gap-4">
        <Input label="Name" defaultValue="Kayseri mantı" fullWidth />
        <Input label="Filling" defaultValue="Spiced lamb" fullWidth />
        <Input
          label="Finish"
          defaultValue="Garlic yogurt, mint butter"
          fullWidth
        />
      </div>
    </Drawer>
  );
}

Placement and size

placement is left, right, top, or bottom. size controls width for left/right and height for top/bottom.

API

PropTypeDefaultDescription
triggerReactElementElement cloned with the open trigger props.
placement'left' | 'right' | 'top' | 'bottom''right'Edge the drawer slides in from.
size'sm' | 'md' | 'lg''md'Extent along the panel axis (width for left/right, height for top/bottom).
titleReactNodeHeading shown at the top.
descriptionReactNodeSupporting copy under the title.
childrenReactNode | (({ close }) => ReactNode)Body; accepts a render function receiving { close }.
footerReactNode | (({ close }) => ReactNode)Footer actions; also receives { close }.
showCloseButtonbooleantrueShow the corner close button.
open / defaultOpenbooleanControlled / uncontrolled open state.
onOpenChange(open: boolean) => voidCalled whenever the open state changes.
modalbooleantrueTrap pointer interaction and hide content below.
closeOnInteractOutside / closeOnEscapebooleantrueDismiss on outside click / Escape.

Styling

Anatomy

PartSelectorDescription
trigger[data-scope="drawer"][data-part="trigger"]The cloned opener element.
backdrop[data-scope="drawer"][data-part="backdrop"]The dimmed scrim.
positioner[data-scope="drawer"][data-part="positioner"]Anchors the content to the edge.
content[data-scope="drawer"][data-part="content"]The translucent sliding panel.
title[data-scope="drawer"][data-part="title"]The heading.
description[data-scope="drawer"][data-part="description"]Supporting copy.
body[data-scope="drawer"][data-part="body"]The main content region.
footer[data-scope="drawer"][data-part="footer"]The actions region.
close-trigger[data-scope="drawer"][data-part="close-trigger"]The corner close button.

Tokens

TokenControls
--manti-drawer-sizesize

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub