BridgeBeta
  • Brand
  • Digital Assets
    Foundations
    Icons
    Components
    Templates
  • Resources
    Design Tokens
    How-tos
    Best Practices
    Libraries
    Accessibility
    Products List
  • Support
    • Overview
    • Actions
      • Overview
      • Button
      • ContextMenu
      • Link
    • Controls
      • Overview
      • Checkbox
      • Tag
      • Toggle
    • Forms
      • Overview
      • DatePicker
      • FileUploader
      • Input
      • NumberInput
      • RadioButton
      • Search
      • Select
      • Slider
      • TextArea
      • TextInput
    • Hooks
      • useIsomorphicLayoutEffect
      • useMediaQuery
      • useSettings
    • Navigation
      • Overview
      • AnchorNavigation
      • BannerNavigation
      • Breadcrumb
      • Footer
      • InfoBar
      • MainNavigation
      • SecondaryNavigation
      • StepNavigation
      • SubNavigation
    • Overlay
      • Overview
      • Credits
      • Modal
      • ModalWrapper
      • Notification
      • Tooltip
    • Structure
      • Overview
      • Accordion
      • AuthLayout
      • Avatar
      • Callout
      • Card
      • ContentSwitcher
      • Empty
      • Hero
      • InlineLoading
      • Item
      • List
      • Loading
      • mdxComponents
      • Module
      • Pagination
      • ReadMore
      • Story
      • Table
      • Tabs
      • Text
      • Unit
      • User
      • WFPCoreProvider
      • Wrapper
Components
Controls
Toggle

Toggle

  • Design
  • Code
  • Props
Design

Toggle

Expand code

Editable Example

import { Toggle } from "@wfp/react";

() => {
  return (
    <Toggle
      defaultToggled
      labelA="Off"
      labelB="On"
      name="togglename"
    />
  );
};

PropDefaultDescriptionValue

defaultToggled

boolean
–

Specify whether the toggle should be on by default

toggled

boolean
–

Use this to make the component controlled. If toggled is passed, the component will not manage its own state.

disabled

boolean
–

labelA

string
–

Specify the label for the "off" position

labelB

string
–

Specify the label for the "on" position

onToggle

(value: boolean,htmlFor: string,event: ChangeEvent<HTMLInputElement>) => void
–

A callback function that is called when the toggle is clicked. It receives the new boolean state, the input's ID, and the original event. This is the recommended handler for new implementations.

className

string
–

id

string
–

Provide an id that unique represents the underlying input

name

string
–

Provide an name that unique represents the underlying input

onChange

(event: ChangeEvent<HTMLInputElement>) => void
–

Provide a function that is called when a change event occurs on the control

ref

any
–

On this page

  • Toggle
Storybook
Figma library
Contact us
2025 © World Food Programme