Components · Overlays
Drawer
A panel that slides in from the right for details and settings people look at for a while, and on a phone a bottom sheet for picking a place to go or reading a short explanation.
import { Drawer } from "@botiverse/raft-ui";A drawer slides in from the right with details and settings that people look at for a while, scroll and edit apart from what is behind it, such as which of Linear's connections an agent uses (Linear for this agent). The page stays in place behind it, under a scrim. Details read together with a conversation, such as a channel's details, a thread or a profile, are not a drawer: they are a column beside the conversation, with no scrim, so the conversation stays in view and in reach while they are open (stdrc, 2026-11-10, #proj-raft-ui:dae8db07; Page structure). On a phone the same component rises from the bottom as a bottom sheet: to pick a place to go, or to read a short explanation with one button.
When to use
Anatomy
Drawer: the root. ItsswipeDirectionsets the edge it comes from. Required.DrawerTrigger: the button that opens it.DrawerContent: the surface, portaled, with the scrim (DrawerOverlay) behind it when the drawer is modal. Required. It islayer-popoverwith aline-seamedge andshadow-float, like every other popup, not an ink border and a hard shadow: every floating surface uses the same shadow (Elevation). It is one surface from the grab handle down: the regions that span its width (a head, a list, a foot) paint no surface of their own, while cards and fields in them keep theirs. A Panel inside it, itsPanelHeaderandPanelFooterincluded, takes the drawer'slayer-popoverby itself, andPanelHeaderkeeps itsline-seam(artin, 2026-11-25, #proj-workspace:f6de4a2b).DrawerHeader: the title row. In a drawer from the right it is the header height (44px on a desktop, 56px on a phone), with aline-seamunder it andDrawerCloseat its end.DrawerTitle: the title. Required, unless the content has anaria-label.DrawerDescription: a helper sentence under the title, only for a consequence (consequence), who sees it or whom it affects (audience), or how to recover (recovery). It takes only aHelperText, made withhelperText(content, { why, about }), and renders itswhyandaboutasdata-whyanddata-about(Writing › Helper text).DrawerBody: the content. It scrolls between the header and the footer, which stay in place: natively in a bottom or top sheet, and in a drawer from the right natively, or under raft-ui's scrollbar withunstable_scrollArea(Scrolling in a ScrollArea).DrawerFooter: the bottom bar. In a drawer from the right it has aline-seamover it.DrawerActions: the buttons in the footer, in a row at the end in a drawer and stacked full width in a bottom sheet, where a ghost Cancel takes a frame (Button).DrawerClose: closes the drawer. Without children it is the × icon button; withrenderit turns another button into a close button.DrawerPortalandDrawerOverlay: lower-level parts.
Variants
Scrolling in a ScrollArea
In a drawer from the right, DrawerBody scrolls natively, so on Windows, and on a Mac set to always show scrollbars, a long body draws the platform's scrollbar, which takes room from the body's width when it appears. With unstable_scrollArea the body is a ScrollArea instead: it scrolls the same way and draws raft-ui's scrollbar, which takes no room and looks the same on every platform and in both themes. The drawer at the top of this page uses it.
- It is opt-in for now and becomes the default in a later minor release, together with the same prop of DialogBody. Nothing else about the body changes, so when it is the default, delete the prop.
- It applies to a drawer from a side (
swipeDirection="right"or"left") only. A bottom or top sheet ignores the prop, andwrapperClassNamewith it: its body is the same element with the same classes as without it. A bottom sheet is a phone surface, where the platform's scrollbar lies over the content, takes no room and shows only while scrolling, so raft-ui's scrollbar would add nothing there; and a downward drag at the top of a sheet's content has to start closing the sheet, which a ScrollArea's hold on the scroll at its ends could change. So a responsive drawer can pass the prop always: it takes effect only from a side. - A bottom or top sheet's body scrolls natively by its own classes, so a sheet whose content grows past its 82% of the window needs no class for it (Behavior). A body that already has
min-h-0 overflow-y-autoof its own, or is a ScrollArea given throughrender, scrolls as it did, and the classes can be removed. - The body is still the element with
data-slot="drawer-body". It takesclassName,ref, the native props,renderand the children as before, and is still the flex column the children are laid out in, so a layout written on it (className="gap-4") is unchanged, and nothing is put inside it beside its children. Its padding is still its own and scrolls with the content. It uses ScrollArea's absolute gutters: a frame,data-slot="drawer-body-frame", is rendered around the body and holds the scrollbar. - The frame, not the body, is the child of
DrawerContent, betweenDrawerHeaderandDrawerFooter. A class that sizes the body in the drawer (max-h-*,h-*,flex-*) goes inwrapperClassName, which is the frame's; padding and layout stay inclassName.renderreplaces the body, not the frame, which is always a<div>. A selector of your own that reaches the body as a child of the content ([data-slot=drawer-content] > [data-slot=drawer-body]) no longer matches: select the frame, or the body as a descendant. - The body is a Tab stop only while it overflows and holds nothing that takes focus, as a native scroller is. A form adds no stop: Tab goes from the header to the first field, and the keyboard scrolls the body from whatever inside it has focus. A long text that is only read can be reached with Tab and scrolled with the arrow keys and Page Down. A
tabIndexof your own wins. - A scroll that reaches the body's end stops there, and a Mac trackpad or iOS still bounces the body (
overscroll="contain", as in a Panel). - The body scrolls sideways too when something in it is wider than it (a wide table, a line that doesn't wrap, a
<pre>, an image), as the native body does: the drawer, its header and its footer keep their width, and a horizontal scrollbar shows along the body's bottom edge, over the footer. A body with nothing wider than itself scrolls down only and draws no horizontal scrollbar. Sideways, the whole body moves, its fields with the wide part, so for a wide table preferTableScroll(Table) around it: then only the table scrolls. - Swiping toward the drawer's edge still dismisses it from anywhere on the body, and a vertical drag on the body scrolls it without moving the drawer. While the body holds something wider than itself, a sideways drag is the body's first, with the prop and without it: a drag away from the edge scrolls it, and a drag toward the edge dismisses the drawer only while the body is at its start, and scrolls it back otherwise.
- The frame is a stacking context of its own, as every ScrollArea is: a popup given a
containerinside the body is drawn under the drawer's header. Leave popups where raft-ui portals them; they still stay under the header and above the drawer's bottom edge (Behavior).
Behavior
- A drawer slides in from its edge with
ease-slide. It is the only overlay that moves, because the slide shows where it came from (Motion). - It slides in however it was mounted: opened after it mounted, or mounted already open (
openordefaultOpen, a lazy or conditional mount, a freshkey). Base UI plays the enter only whenopenturns true after the root mounted, soDrawermounts closed and opens one commit later, before the first paint; otherwise it would show at once, and with snap points at its full height before dropping to its snap point (#proj-frontend:#121). Dialog, AlertDialog and Lightbox wait the same commit, so surfaces mounted open together still stack in their order. - A modal drawer puts the same scrim as a dialog over the rest of the page: the page can't be used while the drawer is open, and the scrim says so. A click on the scrim closes it. A bottom sheet has the scrim too.
- Swiping toward its edge dismisses a drawer.
- A drawer opened from a drawer stacks on top of it, and the one below steps back.
- On a phone, a drawer from the right fills the screen and works as a page: no ×, and Back at the top left.
- A bottom sheet rises to at most 82% of the window height, with
radius-dialogon its top corners, and keeps clear of the home indicator. - A sheet's body scrolls when its content is taller than that: the header stays at the top of the sheet and the footer at its bottom, and the body scrolls between them with the platform's scrollbar. A sheet with less content is as tall as its content and draws no scrollbar. A drag up on the body scrolls it. A drag down closes the sheet when the body is at its top, and scrolls the body back when it is not; a drag down on the header or the grab handle always closes the sheet. What you write in the body keeps its height when the body scrolls, in a sheet as in a drawer from a side: the body is a flex column, and its children don't shrink, so a row of a fixed height stays that tall. A child that is meant to shrink and scroll inside the body instead, such as a list under a fixed lead, takes
flex-1(orshrink) withmin-h-0;min-h-0alone no longer shrinks it. - A sheet with
snapPointsscrolls its body only at its full height (the snap point1). Below it the lower part of the sheet is under the window's edge, and a drag up on the body raises the sheet to its next snap point, so there the body is cut at the sheet's bottom edge and doesn't scroll. A sheet whose snap points don't include1never scrolls its body: keep its content within its tallest snap point. - A Select or Combobox list, a menu or a popover opened from a field in a drawer stays under its
DrawerHeaderand above its bottom edge, or the top of the on-screen keyboard when that is higher: it flips and shrinks there instead of covering the head, as in a dialog's phone sheet (Dialog). Across, it keeps to the window, so a menu in a 420px drawer may still reach over the scrim. A popup anchored in the head, such as a tooltip or a menu on a head button, is left alone and keeps to the window as outside a drawer: it opens where it asks to, since held under the head it would cover the drawer's content. One anchored in the body is always bounded, however short the drawer: the list takes the larger side of its field and its rows scroll. A list let over the head would cover it, or, portaled into the drawer's scrolling body, be drawn under it, where its first rows can't be pressed. AcollisionBoundarypassed to the popup wins;"clipping-ancestors"opts it out.
Content
- Title it with the words of the button that opened it (Writing).
- In a bottom sheet, write the explanation in one or two sentences, as a
HelperTextinDrawerDescriptionwhen it names a consequence, who sees it or how to recover (otherwise as body text), and its button as one action in sentence case: Got it.
Accessibility
- Drawer wraps the Base UI Drawer. It provides the
dialogsemantics, the focus trap of a modal drawer, Esc, swipe to dismiss, and focus return to the trigger. - Give every drawer and bottom sheet a title: a visible
DrawerTitle, or at least anaria-labelonDrawerContent. - The × of
DrawerCloseis labeled "Close". On a phone, give the Back button that replaces it anaria-label("Back"). - The grab handle is hidden from assistive technology. Never make swiping the only way to close: keep ×, Back or a button in the sheet.
Rules
- Keep a drawer to 420px at most. A form that needs more room is the wide Dialog.
- Make the × the same icon button as in a panel header, with the same icon size, and put it last in
DrawerHeader: its icon box ends on the margin, and a Back that replaces it on a phone starts on it (Alignment). - Keep a drawer's head to one line: the title and at most one item beside it on the same line, such as a tag (Default) or what it belongs to (the agent's handle in muted Space Mono, truncating before the title does). Never put a second line under the title: what would go there is in the body, where people read or edit it, so a drawer's head stays one line (stdrc, 2026-11-03).
- Put the buttons in the footer, never in the header. They are
size="lg"(44px on a phone, 34px on a desktop): Cancel first, Save last (Forms). - Split a long form in a drawer into FormSection parts, the same sections as in the wide dialog, and save them all together with the footer's Save.
- Under each yes-or-no checkbox in a drawer form, add a line that says what happens when it is unchecked. It is a checkbox, not a switch, because the form is saved (Forms).
- Give every bottom sheet a grab handle at its top edge: a 36 × 4px bar in
line-seamwith round ends, as every platform draws one.DrawerContentdraws it on everyswipeDirection="down"sheet, content-sized or with snap points, so don't draw one of your own; before 2026-11-02 it drew it only with snap points, and a content-sized sheet had none (Ferry, onboarding v3) (Shape). - In a bottom sheet list, make each row 52px tall, with a 20px icon and the label in
text-body, medium. Mark the current row with a check mark and bold text.
API
Drawer
DrawerActions
Also takes the attributes of its element.
DrawerBody
Also takes the attributes of its element.
DrawerClose
Also takes the attributes of its element.
DrawerContent
Also takes the attributes of its element.
DrawerDescription
Also takes the attributes of its element.
DrawerFooter, DrawerHeader
Also takes the attributes of its element.
DrawerOverlay
Also takes the attributes of its element.
DrawerPortal
Also takes the attributes of its element.
DrawerTitle
Also takes the attributes of its element.
DrawerTrigger
Also takes the attributes of its element.
Related
Changes
- 0.105.1 · FixedPanel, PanelHeader, PanelFooter: inside a sheet (
DrawerContent, orDialogSheetContenton a phone) they paint the sheet'slayer-popoverinstead of their column'slayer-canvas, so the sheet is one surface from the grab handle down;PanelHeaderkeeps itsline-seam. ConversationPanelRoot, ConversationPanelFooter, ThreadPanelRoot and ThreadPanelFooter keeplayer-canvasin a sheet, so a conversation or a thread in a sheet changes only in its head (PanelHeader,ThreadPanelHeader). Beside the page they are unchanged. - 0.103.4 · Design SystemWide touch heads ([Spacing › Heights](https://raft-design.botiverse.build/foundations/spacing/#heights)): by touch from 768px (a tablet, an unfolded foldable, a phone held sideways that wide) a head is 48px, not the phone's 56px, and its bar buttons are 36px with a 20px icon; their hit area still reaches 44px. New token
bar-icon-size, and a fourth token context,wideTouch. Changed in this release:PanelAction,PanelSplitAction,PanelTitleTrigger,SelectionToolbar,Drawer's close button, and every head that readsheader-height. - 0.103.0 · Breaking ChangesExplanation slots take only a
HelperText:FieldDescription,FormSection'sdescription, aChoiceListitem'sdescription,SelectItemDescription,DialogDescription,AlertDialogDescription,DrawerDescription,PopoverDescription,EmptyStateDescription,CardDescription,CardFooter,BannerDescription,DialogFooterNote(work in progress),MessageActionCardHint,MessageActionCardHeaderDescription,MessageActionCardScopeDescriptionandMessageActionCardActionsNote. AHelperTextis made only byhelperText(content, { why, about }):contentis anyReactNode(a string, a formatted message, aTextLinkinside a sentence),whyis"consequence","audience"or"recovery", andaboutnames the thing the line is about. Each slot renders the content withdata-whyanddata-about, and in development warns once when it is given anything else, which it still renders.ToastDescription,NotificationCenterItemBody,EmptyStateTitle,ListRowDescriptionand the status and data parts are unchanged. - 0.99.0 · FixedWith
unstable_scrollArea,DialogBodyand a side drawer'sDrawerBodyscroll sideways to what is wider than they are ([Dialog › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/dialog/#scrolling-in-a-scrollarea), [Drawer › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/drawer/#scrolling-in-a-scrollarea)). The body is now a ScrollArea in both directions (orientation="both"): a child wider than the body (a wide table, a line that doesn't wrap, a<pre>, an image) is reached with a sideways wheel, a trackpad, a finger or the arrow keys, under a horizontal scrollbar along the body's bottom edge, over the footer. Where the two scrollbars meet each stops short of the corner. - 0.99.0 · FixedA side drawer keeps its width when its body holds something wider than itself ([Drawer › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/drawer/#scrolling-in-a-scrollarea)).
DrawerContent's content element (data-slot="drawer-content") now hasmin-w-0, so in a drawer from the right or the left the header, the body and the footer stay as wide as the drawer, and the body scrolls sideways to the wide child: natively withoutunstable_scrollArea, in the ScrollArea with it. - 0.98.0 · AddedA side drawer's
DrawerBodycan scroll in a ScrollArea, with raft-ui's scrollbar in place of the platform's ([Drawer › Scrolling in a ScrollArea](https://raft-design.botiverse.build/components/drawer/#scrolling-in-a-scrollarea)). In a drawer from the right or the left,<DrawerBody unstable_scrollArea>renders a frame (data-slot="drawer-body-frame") around the body and binds the body as a ScrollArea with absolute gutters, asDialogBodydoes with the same prop. The body keepsdata-slot="drawer-body",className,ref, the native props,renderand its children, and is still the flex column they are laid out in, so a layout written on it (className="gap-4") is unchanged and its padding still scrolls with the content;wrapperClassNameis the frame's class, for the classes that size the body in the drawer (max-h-*,h-*,flex-*). The body is a Tab stop only while it overflows and holds nothing that takes focus (atabIndexof your own wins), so a form gains no stop and a long text that is only read can be scrolled with the keyboard, and a scroll stops at its end (overscroll="contain"). A bottom or top sheet ignores both props and renders the body as before. - 0.98.0 · FixedA bottom sheet's
DrawerBodyscrolls ([Drawer › Behavior](https://raft-design.botiverse.build/components/drawer/#behavior)). In aDrawerfrom the bottom or the top (swipeDirection="down", the default, or"up"), the body now hasmin-h-0 overflow-y-autoof its own: a body taller than the sheet's 82% of the window scrolls natively betweenDrawerHeaderandDrawerFooter, which stay in the sheet. In a sheet withsnapPointsthe body scrolls only at its full height (the snap point1) and is cut at the sheet's bottom edge below it (overflow-y-hidden), so a drag up on the body still raises the sheet. - 0.96.1 · FixedA popup anchored in a sheet's body is always kept under the sheet's head, however little room its field has ([Dialog › Popups in a sheet](https://raft-design.botiverse.build/components/dialog/#popups-in-a-sheet), [Drawer › Behavior](https://raft-design.botiverse.build/components/drawer/#behavior)). In
DialogSheetContentbelow 768px, in aDrawerand underSheetPopupBoundary, the sheet no longer stops bounding a list whose field has little of the sheet's area on both sides: the list flips to the larger side, shrinks to it and scrolls. ThePOPUP_ROOM_MIN_PXconstant inlib/popup-boundary, which no entry point exported, is removed.