Marigold
Marigold

Application

MarigoldProvider
RouterProvider

Layout

Aside
Aspect
Breakout
Center
Columns
Container
Grid
Inline
Inset
Scrollable
Split
Stack
Tiles

Actions

ActionBaralpha
Button
Link
LinkButton
ToggleButtonalpha
ToggleButtonGroupalpha

Form

Autocomplete
Calendar
Checkbox
ComboBox
DateField
DatePicker
FileField
Form
Multiselectdeprecated
NumberField
Radio
SearchField
Select
Slider
Switch
TagFieldbeta
TextArea
TextField
TimeField

Collection

SelectList
Tableupdated
Tag

Navigation

Accordion
Breadcrumbs
Pagination
Sidebarbeta
Tabs
TopNavigationbeta

Overlay

ContextualHelp
Dialog
Drawer
Menu
Toastbeta
Tooltip

Content

Badge
Card
Divider
EmptyStatebeta
Headline
Icon
List
Loader
SectionMessage
SVG
Text

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
parseFormData
useAsyncListData
useListData
useResponsiveValue
useTheme
VisuallyHidden
Components

Switch

Component that switches between two states.

The <Switch> component allows the users to select between two states, e.g. on and off.
It consists of a visual selection indicator and a label.

Users may click or touch a Switch to toggle the state, or use the tab key to navigate to it and the space key to toggle it.

Anatomy

Anatomy of table

The styles are separated into some parts (container, label, thumb, track) that you can style in a custom variant.

Appearance

The appearance of a component can be customized using the variant and size props. These props adjust the visual style and dimensions of the component, available values are based on the active theme.

The selected theme does not has any options for"variant" and "size".
PropertyTypeDescription
variant-The available variants of this component.
size-The available sizes of this component.

Usage

Switches are best used to adjust settings and other standalone options. They make a binary selection, like on and off or true and false.

The effects of a switch should start immediately, without needing to save.

Do
Immediately activate or deactivate something

Immediately activate or deactivate something.

Don't
Don't use save actions with switches.

Avoid using a switch to select multiple options that require people to save. Switches should be immediate.

Don't
Avoid using switches to toggle between opposing options.

Avoid using switches to toggle between opposing options.

Props

Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
View Switch stories

Switch

Prop

Type

Alternative components

Alternative selection controls can be used to enter decisions or declare preferences such as settings or dialogs.

  • Checkbox: Select multiple related options in a list.

  • Radio: Select a single option in a list.
Last update: 3 days ago

Slider

Allows to make selections from a range of values.

TagField

A multi-select field that displays selected items as removable tags with a searchable dropdown.

On this page

AnatomyAppearanceUsagePropsSwitchAlternative components