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
        • Checkbox
        • Combobox
        • File upload
        • Input
        • Input group
        • Radio
        • Range
        • Select
        • Textarea
        • Toggle
      • 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
      • Disabled
      • Hidden label
      • Hint text
      • Regular weight label
      • Validation
    • Configuration
    • API
      • Field
      • Toggle

    Toggle

    A Toggle lets users turn something on and off like a light switch. Unlike a Checkbox, which is used for selection, a Toggle is used for activation.


    Table of Contents
    • How to use it
      • Default
      • Disabled
      • Hidden label
      • Hint text
      • Regular weight label
      • Validation
    • Configuration
    • API
      • Field
      • Toggle

    Used for this
    • To see or compare the results of a settings change
    • To activate a mode (such as “dark mode”) which takes immediate effect
    Not for this
    • To let users select from a list of settings, use Checkboxes instead

    How to use it

    Default

    A Toggle’s label is part of its touch target.

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

    Disabled

    A disabled Toggle prevents user interaction. It doesn’t appear in the tab order, can’t receive focus, and may not read aloud by a screenreader.

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

    Hidden label

    Toggle labels can be hidden.

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

    Hint text

    Use hint text for additional context.

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

    Regular weight label

    The label is bold by default. It can be made regular weight too.

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

    Validation

    Show success, warning, or danger validation messages with the Message component.

    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-forms
    • Depsnpm install react react-dom styled-components @zendeskgarden/react-theming
    • Importimport { Toggle, Field } from '@zendeskgarden/react-forms'

    API

    The Toggle component follows this structure:

    <Field>  <Toggle>    <Field.Label />    <Field.Hint />    <Field.Message />  </Toggle></Field>

    Field

    A Field provides accessibility attributes to its child Toggle field by associating it with the corresponding Field.Label and Field.Hint.

    Field.Hint

    Extends HTMLAttributes<HTMLDivElement>

    Nest the Hint within the Toggle component.

    Field.Label

    Extends LabelHTMLAttributes<HTMLLabelElement>

    Nest the Label within the Toggle component.

    Prop nameTypeDefaultDescription
    hidden
    boolean

    Hides the label visually without hiding it from screen readers

    isRegular
    boolean

    Applies regular (non-bold) font weight

    Field.Message

    Extends HTMLAttributes<HTMLDivElement>

    The Message component applies appropriate icon and styles based on the validation provided. Nest it within a Field component.

    Prop nameTypeDefaultDescription
    validation
    'success' | 'warning' | 'error'

    Applies validation state styling

    validationLabel
    string

    Defines the aria-label for the validation icon

    Toggle

    Extends InputHTMLAttributes<HTMLInputElement>

    Nest a Toggle within a Field component.

    Prop nameTypeDefaultDescription
    isCompact
    boolean

    Applies compact styling

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