Garden 9 is now available.
The website has been updated to the latest major version. View previous versions
Skip to main content
Design
Components
Patterns
    • Introduction
      • Overview
    • Foundations
      • Bedrock CSS
      • Design tokens
      • Containers
      • Theming
      • Versions
    • Components
      • Accordion
      • Anchor
      • Avatar
      • Breadcrumbs
      • Buttons
      • Chrome
      • Code block
      • Color picker
      • Color swatch
      • Date picker
      • Draggable
      • Drawer
      • Forms
      • Grid
      • Loaders
      • Menu
      • Modal
      • Notification
      • Pagination
      • Pane
      • Sheet
      • Status indicator
      • Stepper
      • Table
      • Tabs
      • Tags
      • Tiles
      • Timeline
      • Tooltip
      • Tooltip dialog
      • Typography
      • Well
    Table of Contents
    • How to use it
      • Default
      • Danger
      • Size
    • Configuration
    • API
      • Modal

    Modal

    A Modal is a dialog box that sits on the top of the current page. Modals block access to the rest of the page and force user interaction.


    Table of Contents
    • How to use it
      • Default
      • Danger
      • Size
    • Configuration
    • API
      • Modal

    Used for this
    • To interrupt users with a dialog that requests information or an action
    Not for this
    • To provide users with information that doesn’t require interruption, use a Notification instead

    How to use it

    Default

    The typical usage of a Modal component.

    Toggle dark mode
    Set primary hue
    Toggle RTL
    Open in CodeSandbox
    Copy code
    View code

    Danger

    Use Danger styling for modals that enable a destructive action.

    Toggle dark mode
    Set primary hue
    Toggle RTL
    Open in CodeSandbox
    Copy code
    View code

    Size

    A modal can be default or large.

    Toggle dark mode
    Set primary hue
    Toggle RTL
    Open in CodeSandbox
    Copy code
    View code

    Configuration

    • Name9.5.3•View source•View on npm
    • Installnpm install @zendeskgarden/react-modals
    • Depsnpm install react react-dom styled-components @zendeskgarden/react-theming
    • Importimport { Modal } from '@zendeskgarden/react-modals'

    API

    Modal

    Prop nameTypeDefaultDescription
    appendToNode
    Element

    Defines the DOM element that the modal will attatch to

    backdropProps
    HTMLAttributes<HTMLDivElement>

    Passes HTML attributes to the backdrop element

    focusOnMount
    boolean

    Directs keyboard focus to the modal on mount

    isAnimated
    boolean
    true

    Animates the modal

    isCentered
    boolean
    true

    Centers the modal on the backdrop

    isLarge
    boolean

    Applies large styling

    onClose
    ((event: KeyboardEvent<Element> | MouseEvent<Element, MouseEvent>) => void)

    Handles close actions. Can be triggered from the backdrop and from the close icon.

    Parameters
    event

    The DOM event that triggered the close action

    restoreFocus
    boolean

    Returns keyboard focus to the element that triggered the modal

    Modal.Body

    Extends HTMLAttributes<HTMLDivElement>

    Modal.Close

    Extends ButtonHTMLAttributes<HTMLButtonElement>

    Modal.Footer

    Extends HTMLAttributes<HTMLDivElement>

    Modal.FooterItem

    Extends HTMLAttributes<HTMLSpanElement>

    Modal.Header

    Extends HTMLAttributes<HTMLDivElement>

    Prop nameTypeDefaultDescription
    isDanger
    boolean

    Applies danger styling

    tag
    any
    div

    Updates the element's HTML tag

    Garden is the design system by Zendesk.
    BlogGitHubVersions
    © Zendesk 2025