logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
6.3.2
  • Components Overview
  • Changelog
    v6.3.2
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Custom Placement
Resizable
Loading
Extra Actions
Render in current dom
Submit form in drawer
Preview drawer
Multi-level drawer
Preset size
mask
Closable placement
Custom semantic dom styling
API
ResizableConfig
Semantic DOM
Design Token

Drawer

A panel that slides out from the edge of the screen.
Importimport { Drawer } from 'antd';
GitHub
components/drawerIssueOpen issues
Docs
Edit this pageLLMs.md
contributors
    AlertMessage

    Resources

    Ant Design X
    Ant Design Charts
    Ant Design Pro
    Pro Components
    Ant Design Mobile
    Ant Design Mini
    Ant Design Web3
    Ant Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Ant Design
    Medium
    X
    yuque logoAnt Design in YuQue
    Ant Design in Zhihu
    Experience Cloud Blog
    seeconf logoSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTech logoMore Products

    yuque logoYuQue-Document Collaboration Platform
    AntV logoAntV-Data Visualization
    Egg logoEgg-Enterprise Node.js Framework
    Kitchen logoKitchen-Sketch Toolkit
    Galacean logoGalacean-Interactive Graphics Solution
    WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
    xtech logoAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Ant Design Community
    loading

    When To Use

    A Drawer is a panel that is typically overlaid on top of a page and slides in from the side. It contains a set of information or actions. Since the user can interact with the Drawer without leaving the current page, tasks can be achieved more efficiently within the same context.

    • Use a Form to create or edit a set of information.
    • Processing subtasks. When subtasks are too heavy for a Popover and we still want to keep the subtasks in the context of the main task, Drawer comes very handy.
    • When the same Form is needed in multiple places.

    Notes for developers

    Since the 5.17.0, we provided the loading prop by the Spin. However, since the 5.18.0 version, we have fixed this design error and replaced the Spin with the Skeleton, and also modified the type of loading prop, which can only accept boolean type.

    Examples

    API

    Common props ref:Common props

    PropsDescriptionTypeDefaultVersion
    afterOpenChangeCallback after the animation ends when switching drawersfunction(open)-
    classNameConfig Drawer Panel className. Use rootClassName if want to config top DOM stylestring-
    classNamesCustomize class for each semantic structure inside the Drawer component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
    closableWhether to show a close button. The position can be configured with placementboolean | { closeIcon?: React.ReactNode; disabled?: boolean; placement?: 'start' | 'end' }trueplacement: 5.28.0
    destroyOnCloseWhether to unmount child components on closing drawer or notbooleanfalse
    destroyOnHiddenWhether to unmount child components on closing drawer or notbooleanfalse5.25.0
    extraExtra actions area at cornerReactNode-4.17.0
    footerThe footer for DrawerReactNode-
    forceRenderPre-render Drawer component forciblybooleanfalse
    focusableConfiguration for focus management in the Drawer{ trap?: boolean, focusTriggerAfterClose?: boolean }-6.2.0
    getContainermounted node and display window for DrawerHTMLElement | () => HTMLElement | Selectors | falsebody
    headerStyleStyle of the drawer header part, please use styles.header insteadCSSProperties-
    heightPlacement is top or bottom, height of the Drawer dialog, please use size insteadstring | number378
    keyboardWhether support press esc to closebooleantrue
    loadingShow the Skeletonbooleanfalse5.17.0
    maskMask effectboolean | { enabled?: boolean, blur?: boolean, closable?: boolean }truemask.closable: 6.3.0
    maskClosableClicking on the mask (area outside the Drawer) to close the Drawer or notbooleantrue
    maxSizeMaximum size (width or height depending on placement) when resizablenumber-6.0.0
    openWhether the Drawer dialog is visible or notbooleanfalse
    placementThe placement of the Drawertop | right | bottom | leftright
    pushNested drawers push behaviorboolean | { distance: string | number }{ distance: 180 }4.5.0+
    resizableEnable resizable by draggingboolean | ResizableConfig-boolean: 6.1.0
    rootStyleStyle of wrapper element which contains mask compare to styleCSSProperties-
    sizepreset size of drawer, default 378px and large 736px, or a custom number'default' | 'large' | number | string'default'4.17.0, string: 6.2.0
    styleStyle of Drawer panel. Use styles.body if want to config body onlyCSSProperties-
    stylesCustomize inline style for each semantic structure inside the Drawer component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-
    titleThe title for DrawerReactNode-
    widthWidth of the Drawer dialog, please use size insteadstring | number378
    zIndexThe z-index of the Drawernumber1000
    onCloseSpecify a callback that will be called when a user clicks mask, close button or Cancel buttonfunction(e)-
    drawerRenderCustom drawer content render(node: ReactNode) => ReactNode-5.18.0

    ResizableConfig

    PropsDescriptionTypeDefaultVersion
    onResizeStartCallback when resize starts() => void-6.0.0
    onResizeCallback during resizing(size: number) => void-6.0.0
    onResizeEndCallback when resize ends() => void-6.0.0

    Semantic DOM

    Design Token

    Component TokenHow to use?
    Token NameDescriptionTypeDefault Value
    draggerSizeSize of resize handlenumber4
    footerPaddingBlockVertical padding of footernumber8
    footerPaddingInlineHorizontal padding of footernumber16
    zIndexPopupz-index of drawernumber1000
    Global TokenHow to use?
    Basic

    Basic drawer.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Resizable

    Resizable drawer that allows users to adjust the drawer's width or height by dragging the edge.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    6.0.0
    Extra Actions

    Extra actions should be placed at corner of drawer in Ant Design, you can use extra prop for that.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Submit form in drawer

    Use a form in Drawer with a submit button.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Multi-level drawer

    Open a new drawer on top of an existing drawer to handle multi branch tasks.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    mask

    mask effect.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Custom semantic dom styling

    You can customize the semantic dom style of Drawer by passing objects or functions through classNames and styles.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    6.0.0
    Custom Placement

    The Drawer can appear from any edge of the screen.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Loading

    Set the loading status of Drawer.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    5.17.0
    Render in current dom

    Render in current dom. custom container, check getContainer.

    Note: style and className props are moved to Drawer panel in v5 which is aligned with Modal component. Original style and className props are replaced by rootStyle and rootClassName.

    When getContainer returns a DOM node, you need to manually set rootStyle to { position: 'absolute' }, see #41951.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Preview drawer

    Use Drawer to quickly preview details of an object, such as those in a list.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Preset size

    The default width (or height) of Drawer is 378px, and there is a preset large size 736px.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    Closable placement

    Drawer with closable placement, customize the close placement to the end, defaults to start.

    CodeSandbox Icon
    Hitu Icon
    codepen icon
    External Link Icon
    Expand Icon
    5.28.0
    Current size: 256px
    Render in this
    • Lily

      Progresser XTech
      • View Profile
    • Lily

      Progresser XTech
      • View Profile
    • root
      6.0.0
      Root element with fixed positioning, z-index control, pointer events, color and other basic styles and layout control for drawer container
    • mask
      5.13.0
      Mask element with absolute positioning, z-index, background color, pointer events and other mask layer styles and interaction controls
    • section
      6.0.0
      Drawer container element with flex layout, width/height, overflow control, background color, pointer events and other drawer body styles
    • header
      5.13.0
      Header element with flex layout, alignment, padding, font size, line height, bottom border and other header area styles
    • title
      6.0.0
      Title element with flex ratio, margin, font weight, font size, line height and other title text styles
    • extra
      6.0.0
      Extra element with flex fixed layout and other additional operation content style controls
    • body
      5.13.0
      Body element with flex ratio, minimum size, padding, overflow scroll and other content area display and layout styles
    • footer
      5.13.0
      Footer element with flex shrink, padding, top border and other bottom operation area styles
    • dragger
      6.0.0
      Dragger element used to resize the drawer, with absolute positioning, transparent background, pointer events control, hover state styles, and dragging state styles
    • close
      6.1.0
      Close button element with basic button styling