Skip to main content

Drawer

The Drawer component is a modal component that can be positioned to the left, right, top or bottom of the viewport. It can be used to display additional information or actions without leaving the current screen. It renders contents similar to the Modal component and supports a header, body, fixed footer and icon.

Result
Live Editor

Variations, Scrolling, and Tooltips

The Drawer components allow for customization similar to Modal. The body supports the prop bordered which will render a variant of the body that places a border at the top and bottom of the body.

This example also shows using the scrollable prop on the body to allow for scrolling within the body.

❗Tooltips need to be attached to a container outside of the Drawer.Body. Here the Tooltip on the Select label is attached to the Drawer.Header.

Result
Live Editor

Sizes

The size of the Drawer can be customized. However, all Drawers will be full screen below the medium breakpoint.

Result
Live Editor

Responsive Footers

Responsive footers will adjust the display order of their button children below the small breakpoint.

Result
Live Editor

With DrawerSlide

The DrawerSlide component lets you display additional content in a Drawer. When shown, it will slide in and cover the main content and footer of your Drawer.

Result
Live Editor

Props

Drawer

NameTypeDefault ValueRequiredDescription
analyticsanyNo
autoFocusbooleantrueNoWhen `true` The modal will automatically shift focus to itself when it opens, and replace it to the last focused element when it closes. This also works correctly with any Modal children that have the `autoFocus` prop. Generally this should never be set to `false` as it makes the Modal less accessible to assistive technologies, like screen readers.
backdropboolean | "static"NoInclude a backdrop component. A `static`backdrop will not trigger a Modal onHide when clicked.
backdropClassNamestringNo
bsPrefixstringNo
classNamestringNo
containerDOMContainerNoA DOM element, a `ref` to an element, or function that returns either. The Modal is appended to it's `container` element.
enforceFocusbooleantrueNoWhen `true` The modal will prevent focus from leaving the Modal while open. Generally this should never be set to `false` as it makes the Modal less accessible to assistive technologies, like screen readers.
keyKeyNo
keyboardbooleanNoClose the modal when escape key is pressed
managerModalManagerNoA ModalManager instance used to track and manage the state of open Modals. Useful when customizing how modals interact within a container
onBackdropClick(e: React.SyntheticEvent) => voidNoA callback fired when the backdrop, if specified, is clicked.
onEnter(node: HTMLElement, isAppearing: boolean) => anyNoCallback fired before the component transitions in
onEntered(node: HTMLElement, isAppearing: boolean) => anyNoCallback fired after the component finishes transitioning in
onEntering(node: HTMLElement, isAppearing: boolean) => anyNoCallback fired as the component begins to transition in
onEscapeKeyDown(e: KeyboardEvent) => voidNoA callback fired when the escape key, if specified in `keyboard`, is pressed. If preventDefault() is called on the keyboard event, closing the modal will be cancelled.
onExit(node: HTMLElement) => anyNoCallback fired right before the component transitions out
onExited(node: HTMLElement) => anyNoCallback fired after the component finishes transitioning out
onExiting(node: HTMLElement) => anyNoCallback fired as the component begins to transition out
onHide() => voidNoA callback fired when either the backdrop is clicked, or the escape key is pressed. The `onHide` callback only signals intent from the Modal, you must actually set the `show` prop to `false` for the Modal to close.
onShow() => voidNoA callback fired when the Modal is opening.
placementOffcanvasPlacementNo
refRef<HTMLDivElement>No
renderStaticNodebooleanNo
responsivestringNo
restoreFocusbooleantrueNoWhen `true` The modal will restore focus to previously focused element once modal is hidden
restoreFocusOptions{ preventScroll: boolean; }NoOptions passed to focus function when `restoreFocus` is set to `true` @link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#Parameters
runBackdropTransitionTransitionHandlerNoA transition handler, called with the `show` state and backdrop element. Should return a promise when the transition is complete
runTransitionTransitionHandlerNoA transition handler, called with the `show` state and dialog element. Should return a promise when the transition is complete
scrollbooleanNo
showbooleanNoSet the visibility of the Modal
size"sm" | "md" | "lg" | "xl"smNo
styleCSSPropertiesNo

DrawerHeader

The DrawerHeader supports a static set of props to render title, subtitle, and icon in a consistent manner. It also supports rendering children for more customization.

NameTypeDefault ValueRequiredDescription
bsPrefixstringNo
closeButtonbooleanNo
closeLabelstringNo
closeVariantstringNo
keyKeyNo
onHide() => voidNo
refRef<HTMLDivElement>No
renderIcon() => React.ReactNodeNo
subtitleReact.ReactNodeNo
titleReact.ReactNodeNo
NameTypeDefault ValueRequiredDescription
aboutstringNo
accessKeystringNo
aria-activedescendantstringNoIdentifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
aria-atomicBooleanishNoIndicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
aria-autocomplete"list" | "none" | "inline" | "both"NoIndicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.
aria-busyBooleanishNoIndicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.
aria-checkedboolean | "true" | "false" | "mixed"NoIndicates the current "checked" state of checkboxes, radio buttons, and other widgets. @see aria-pressed @see aria-selected.
aria-colcountnumberNoDefines the total number of columns in a table, grid, or treegrid. @see aria-colindex.
aria-colindexnumberNoDefines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. @see aria-colcount @see aria-colspan.
aria-colspannumberNoDefines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. @see aria-colindex @see aria-rowspan.
aria-controlsstringNoIdentifies the element (or elements) whose contents or presence are controlled by the current element. @see aria-owns.
aria-currentboolean | "time" | "step" | "true" | "false" | "page" | "location" | "date"NoIndicates the element that represents the current item within a container or set of related elements.
aria-describedbystringNoIdentifies the element (or elements) that describes the object. @see aria-labelledby
aria-detailsstringNoIdentifies the element that provides a detailed, extended description for the object. @see aria-describedby.
aria-disabledBooleanishNoIndicates that the element is perceivable but disabled, so it is not editable or otherwise operable. @see aria-hidden @see aria-readonly.
aria-dropeffect"link" | "none" | "copy" | "execute" | "move" | "popup"NoIndicates what functions can be performed when a dragged object is released on the drop target. @deprecated in ARIA 1.1
aria-errormessagestringNoIdentifies the element that provides an error message for the object. @see aria-invalid @see aria-describedby.
aria-expandedBooleanishNoIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-flowtostringNoIdentifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
aria-grabbedBooleanishNoIndicates an element's "grabbed" state in a drag-and-drop operation. @deprecated in ARIA 1.1
aria-haspopupboolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree"NoIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-hiddenBooleanishNoIndicates whether the element is exposed to an accessibility API. @see aria-disabled.
aria-invalidboolean | "true" | "false" | "grammar" | "spelling"NoIndicates the entered value does not conform to the format expected by the application. @see aria-errormessage.
aria-keyshortcutsstringNoIndicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
aria-labelstringNoDefines a string value that labels the current element. @see aria-labelledby.
aria-labelledbystringNoIdentifies the element (or elements) that labels the current element. @see aria-describedby.
aria-levelnumberNoDefines the hierarchical level of an element within a structure.
aria-live"off" | "assertive" | "polite"NoIndicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
aria-modalBooleanishNoIndicates whether an element is modal when displayed.
aria-multilineBooleanishNoIndicates whether a text box accepts multiple lines of input or only a single line.
aria-multiselectableBooleanishNoIndicates that the user may select more than one item from the current selectable descendants.
aria-orientation"horizontal" | "vertical"NoIndicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
aria-ownsstringNoIdentifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship. @see aria-controls.
aria-placeholderstringNoDefines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
aria-posinsetnumberNoDefines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. @see aria-setsize.
aria-pressedboolean | "true" | "false" | "mixed"NoIndicates the current "pressed" state of toggle buttons. @see aria-checked @see aria-selected.
aria-readonlyBooleanishNoIndicates that the element is not editable, but is otherwise operable. @see aria-disabled.
aria-relevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals"NoIndicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. @see aria-atomic.
aria-requiredBooleanishNoIndicates that user input is required on the element before a form may be submitted.
aria-roledescriptionstringNoDefines a human-readable, author-localized description for the role of an element.
aria-rowcountnumberNoDefines the total number of rows in a table, grid, or treegrid. @see aria-rowindex.
aria-rowindexnumberNoDefines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. @see aria-rowcount @see aria-rowspan.
aria-rowspannumberNoDefines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. @see aria-rowindex @see aria-colspan.
aria-selectedBooleanishNoIndicates the current "selected" state of various widgets. @see aria-checked @see aria-pressed.
aria-setsizenumberNoDefines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. @see aria-posinset.
aria-sort"none" | "ascending" | "descending" | "other"NoIndicates if items in a table or grid are sorted in ascending or descending order.
aria-valuemaxnumberNoDefines the maximum allowed value for a range widget.
aria-valueminnumberNoDefines the minimum allowed value for a range widget.
aria-valuenownumberNoDefines the current value for a range widget. @see aria-valuetext.
aria-valuetextstringNoDefines the human readable text alternative of aria-valuenow for a range widget.
autoCapitalizestringNo
autoCorrectstringNo
autoSavestringNo
classNamestringNo
colorstringNo
contentEditableBooleanish | "inherit"No
contextMenustringNo
dangerouslySetInnerHTML{ __html: string; }No
datatypestringNo
defaultCheckedbooleanNo
defaultValuestring | number | readonly string[]No
dirstringNo
draggableBooleanishNo
hiddenbooleanNo
idstringNo
inlistanyNo
inputMode"text" | "none" | "search" | "tel" | "url" | "email" | "numeric" | "decimal"NoHints at the type of data that might be entered by the user while editing the element or its contents @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
isstringNoSpecify that a standard HTML element should behave like a defined custom built-in element @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
itemIDstringNo
itemPropstringNo
itemRefstringNo
itemScopebooleanNo
itemTypestringNo
langstringNo
onAbortReactEventHandler<HTMLDivElement>No
onAbortCaptureReactEventHandler<HTMLDivElement>No
onAnimationEndAnimationEventHandler<HTMLDivElement>No
onAnimationEndCaptureAnimationEventHandler<HTMLDivElement>No
onAnimationIterationAnimationEventHandler<HTMLDivElement>No
onAnimationIterationCaptureAnimationEventHandler<HTMLDivElement>No
onAnimationStartAnimationEventHandler<HTMLDivElement>No
onAnimationStartCaptureAnimationEventHandler<HTMLDivElement>No
onAuxClickMouseEventHandler<HTMLDivElement>No
onAuxClickCaptureMouseEventHandler<HTMLDivElement>No
onBeforeInputFormEventHandler<HTMLDivElement>No
onBeforeInputCaptureFormEventHandler<HTMLDivElement>No
onBlurFocusEventHandler<HTMLDivElement>No
onBlurCaptureFocusEventHandler<HTMLDivElement>No
onCanPlayReactEventHandler<HTMLDivElement>No
onCanPlayCaptureReactEventHandler<HTMLDivElement>No
onCanPlayThroughReactEventHandler<HTMLDivElement>No
onCanPlayThroughCaptureReactEventHandler<HTMLDivElement>No
onChangeFormEventHandler<HTMLDivElement>No
onChangeCaptureFormEventHandler<HTMLDivElement>No
onClickMouseEventHandler<HTMLDivElement>No
onClickCaptureMouseEventHandler<HTMLDivElement>No
onCompositionEndCompositionEventHandler<HTMLDivElement>No
onCompositionEndCaptureCompositionEventHandler<HTMLDivElement>No
onCompositionStartCompositionEventHandler<HTMLDivElement>No
onCompositionStartCaptureCompositionEventHandler<HTMLDivElement>No
onCompositionUpdateCompositionEventHandler<HTMLDivElement>No
onCompositionUpdateCaptureCompositionEventHandler<HTMLDivElement>No
onContextMenuMouseEventHandler<HTMLDivElement>No
onContextMenuCaptureMouseEventHandler<HTMLDivElement>No
onCopyClipboardEventHandler<HTMLDivElement>No
onCopyCaptureClipboardEventHandler<HTMLDivElement>No
onCutClipboardEventHandler<HTMLDivElement>No
onCutCaptureClipboardEventHandler<HTMLDivElement>No
onDoubleClickMouseEventHandler<HTMLDivElement>No
onDoubleClickCaptureMouseEventHandler<HTMLDivElement>No
onDragDragEventHandler<HTMLDivElement>No
onDragCaptureDragEventHandler<HTMLDivElement>No
onDragEndDragEventHandler<HTMLDivElement>No
onDragEndCaptureDragEventHandler<HTMLDivElement>No
onDragEnterDragEventHandler<HTMLDivElement>No
onDragEnterCaptureDragEventHandler<HTMLDivElement>No
onDragExitDragEventHandler<HTMLDivElement>No
onDragExitCaptureDragEventHandler<HTMLDivElement>No
onDragLeaveDragEventHandler<HTMLDivElement>No
onDragLeaveCaptureDragEventHandler<HTMLDivElement>No
onDragOverDragEventHandler<HTMLDivElement>No
onDragOverCaptureDragEventHandler<HTMLDivElement>No
onDragStartDragEventHandler<HTMLDivElement>No
onDragStartCaptureDragEventHandler<HTMLDivElement>No
onDropDragEventHandler<HTMLDivElement>No
onDropCaptureDragEventHandler<HTMLDivElement>No
onDurationChangeReactEventHandler<HTMLDivElement>No
onDurationChangeCaptureReactEventHandler<HTMLDivElement>No
onEmptiedReactEventHandler<HTMLDivElement>No
onEmptiedCaptureReactEventHandler<HTMLDivElement>No
onEncryptedReactEventHandler<HTMLDivElement>No
onEncryptedCaptureReactEventHandler<HTMLDivElement>No
onEndedReactEventHandler<HTMLDivElement>No
onEndedCaptureReactEventHandler<HTMLDivElement>No
onErrorReactEventHandler<HTMLDivElement>No
onErrorCaptureReactEventHandler<HTMLDivElement>No
onFocusFocusEventHandler<HTMLDivElement>No
onFocusCaptureFocusEventHandler<HTMLDivElement>No
onGotPointerCapturePointerEventHandler<HTMLDivElement>No
onGotPointerCaptureCapturePointerEventHandler<HTMLDivElement>No
onInputFormEventHandler<HTMLDivElement>No
onInputCaptureFormEventHandler<HTMLDivElement>No
onInvalidFormEventHandler<HTMLDivElement>No
onInvalidCaptureFormEventHandler<HTMLDivElement>No
onKeyDownKeyboardEventHandler<HTMLDivElement>No
onKeyDownCaptureKeyboardEventHandler<HTMLDivElement>No
onKeyPressKeyboardEventHandler<HTMLDivElement>No
onKeyPressCaptureKeyboardEventHandler<HTMLDivElement>No
onKeyUpKeyboardEventHandler<HTMLDivElement>No
onKeyUpCaptureKeyboardEventHandler<HTMLDivElement>No
onLoadReactEventHandler<HTMLDivElement>No
onLoadCaptureReactEventHandler<HTMLDivElement>No
onLoadedDataReactEventHandler<HTMLDivElement>No
onLoadedDataCaptureReactEventHandler<HTMLDivElement>No
onLoadedMetadataReactEventHandler<HTMLDivElement>No
onLoadedMetadataCaptureReactEventHandler<HTMLDivElement>No
onLoadStartReactEventHandler<HTMLDivElement>No
onLoadStartCaptureReactEventHandler<HTMLDivElement>No
onLostPointerCapturePointerEventHandler<HTMLDivElement>No
onLostPointerCaptureCapturePointerEventHandler<HTMLDivElement>No
onMouseDownMouseEventHandler<HTMLDivElement>No
onMouseDownCaptureMouseEventHandler<HTMLDivElement>No
onMouseEnterMouseEventHandler<HTMLDivElement>No
onMouseLeaveMouseEventHandler<HTMLDivElement>No
onMouseMoveMouseEventHandler<HTMLDivElement>No
onMouseMoveCaptureMouseEventHandler<HTMLDivElement>No
onMouseOutMouseEventHandler<HTMLDivElement>No
onMouseOutCaptureMouseEventHandler<HTMLDivElement>No
onMouseOverMouseEventHandler<HTMLDivElement>No
onMouseOverCaptureMouseEventHandler<HTMLDivElement>No
onMouseUpMouseEventHandler<HTMLDivElement>No
onMouseUpCaptureMouseEventHandler<HTMLDivElement>No
onPasteClipboardEventHandler<HTMLDivElement>No
onPasteCaptureClipboardEventHandler<HTMLDivElement>No
onPauseReactEventHandler<HTMLDivElement>No
onPauseCaptureReactEventHandler<HTMLDivElement>No
onPlayReactEventHandler<HTMLDivElement>No
onPlayCaptureReactEventHandler<HTMLDivElement>No
onPlayingReactEventHandler<HTMLDivElement>No
onPlayingCaptureReactEventHandler<HTMLDivElement>No
onPointerCancelPointerEventHandler<HTMLDivElement>No
onPointerCancelCapturePointerEventHandler<HTMLDivElement>No
onPointerDownPointerEventHandler<HTMLDivElement>No
onPointerDownCapturePointerEventHandler<HTMLDivElement>No
onPointerEnterPointerEventHandler<HTMLDivElement>No
onPointerEnterCapturePointerEventHandler<HTMLDivElement>No
onPointerLeavePointerEventHandler<HTMLDivElement>No
onPointerLeaveCapturePointerEventHandler<HTMLDivElement>No
onPointerMovePointerEventHandler<HTMLDivElement>No
onPointerMoveCapturePointerEventHandler<HTMLDivElement>No
onPointerOutPointerEventHandler<HTMLDivElement>No
onPointerOutCapturePointerEventHandler<HTMLDivElement>No
onPointerOverPointerEventHandler<HTMLDivElement>No
onPointerOverCapturePointerEventHandler<HTMLDivElement>No
onPointerUpPointerEventHandler<HTMLDivElement>No
onPointerUpCapturePointerEventHandler<HTMLDivElement>No
onProgressReactEventHandler<HTMLDivElement>No
onProgressCaptureReactEventHandler<HTMLDivElement>No
onRateChangeReactEventHandler<HTMLDivElement>No
onRateChangeCaptureReactEventHandler<HTMLDivElement>No
onResetFormEventHandler<HTMLDivElement>No
onResetCaptureFormEventHandler<HTMLDivElement>No
onScrollUIEventHandler<HTMLDivElement>No
onScrollCaptureUIEventHandler<HTMLDivElement>No
onSeekedReactEventHandler<HTMLDivElement>No
onSeekedCaptureReactEventHandler<HTMLDivElement>No
onSeekingReactEventHandler<HTMLDivElement>No
onSeekingCaptureReactEventHandler<HTMLDivElement>No
onSelectReactEventHandler<HTMLDivElement>No
onSelectCaptureReactEventHandler<HTMLDivElement>No
onStalledReactEventHandler<HTMLDivElement>No
onStalledCaptureReactEventHandler<HTMLDivElement>No
onSubmitFormEventHandler<HTMLDivElement>No
onSubmitCaptureFormEventHandler<HTMLDivElement>No
onSuspendReactEventHandler<HTMLDivElement>No
onSuspendCaptureReactEventHandler<HTMLDivElement>No
onTimeUpdateReactEventHandler<HTMLDivElement>No
onTimeUpdateCaptureReactEventHandler<HTMLDivElement>No
onTouchCancelTouchEventHandler<HTMLDivElement>No
onTouchCancelCaptureTouchEventHandler<HTMLDivElement>No
onTouchEndTouchEventHandler<HTMLDivElement>No
onTouchEndCaptureTouchEventHandler<HTMLDivElement>No
onTouchMoveTouchEventHandler<HTMLDivElement>No
onTouchMoveCaptureTouchEventHandler<HTMLDivElement>No
onTouchStartTouchEventHandler<HTMLDivElement>No
onTouchStartCaptureTouchEventHandler<HTMLDivElement>No
onTransitionEndTransitionEventHandler<HTMLDivElement>No
onTransitionEndCaptureTransitionEventHandler<HTMLDivElement>No
onVolumeChangeReactEventHandler<HTMLDivElement>No
onVolumeChangeCaptureReactEventHandler<HTMLDivElement>No
onWaitingReactEventHandler<HTMLDivElement>No
onWaitingCaptureReactEventHandler<HTMLDivElement>No
onWheelWheelEventHandler<HTMLDivElement>No
onWheelCaptureWheelEventHandler<HTMLDivElement>No
placeholderstringNo
prefixstringNo
propertystringNo
radioGroupstringNo
resourcestringNo
resultsnumberNo
roleAriaRoleNo
securitystringNo
slotstringNo
spellCheckBooleanishNo
styleCSSPropertiesNo
suppressContentEditableWarningbooleanNo
suppressHydrationWarningbooleanNo
tabIndexnumberNo
translate"yes" | "no"No
typeofstringNo
unselectable"on" | "off"No
vocabstringNo

DrawerBody

NameTypeDefault ValueRequiredDescription
borderedbooleanNo
keyKeyNo
refRef<HTMLDivElement>No
scrollablebooleanNo

DrawerFooter

The DrawerFooter component will automatically adjust the display of the buttons within such that they stack.

NameTypeDefault ValueRequiredDescription
keyKeyNo
refRef<HTMLDivElement>No
responsivebooleanfalseNoIf `true`, the footer will change layout and button ordering. This affects the default display of the footer and any immediate button children.

DrawerSlide

The DrawerSlide component allows you to slide in secondary content in a Drawer.

NameTypeDefault ValueRequiredDescription
onClickBack() => void() => {}No
onEnter(node: HTMLElement, isAppearing: boolean) => anyNoCallback fired before the component transitions in
onEntered(node: HTMLElement, isAppearing: boolean) => anyNoCallback fired after the component finishes transitioning in
onEntering(node: HTMLElement, isAppearing: boolean) => anyNoCallback fired as the component begins to transition in
onExit(node: HTMLElement) => anyNoCallback fired right before the component transitions out
onExited(node: HTMLElement) => anyNoCallback fired after the component finishes transitioning out
onExiting(node: HTMLElement) => anyNoCallback fired as the component begins to transition out
renderBackButton() => React.ReactNodeNo
showbooleanfalseNo