G
Tokens
TypographySpacingColorRadiusShadowMotion
Foundational
FieldMenuTextbox

Switch

Active


    <Stack gap="s">
      <Switch id="neutralSwitch"/>
      <Switch id="activeSwitch" isActive onChange={() => {}}/>
    </Stack>
  

Label


    <Stack gap="l">
      <Switch id="withStandardLabel" label="Label"/>
      
      <Box borderSide="all" width="min(320px, 100%)">
        <Arrange 
          gap="s" 
          justifyContent="space-between"
          borderSide="bottom" 
          width="min(320px, 100%)" 
          padding="m"
        >
          <Switch id="withCustomComposition"/>
          <Switch.Label htmlFor="withCustomComposition">Switch.Label</Switch.Label>
        </Arrange>
        
        <Arrange
          gap="s" 
          justifyContent="space-between"
          width="min(320px, 100%)" 
          padding="m"
        >
          <Switch id="withCustomLabel"/>
          <Text tag="label" htmlFor="withCustomLabel">Custom label</Text>
        </Arrange>
      </Box>
    </Stack>
  

Hint


    <Switch id="hintSwitch" label="Label" hint="Hint"/>
  

Disabled


    <Stack gap="l">
      <Switch id="disabledSwitch" label="Can't switch" isDisabled/>
      <Switch id="disabledActiveSwitch" label="Can't switch" isDisabled isActive onChange={() => {}}/>
    </Stack>
  

Callback


    <Switch id="withOnChange" label="Switch me" onChange={() => alert('Switched')}/>
  

Props

Name
Type
Default
idREQUIRED
string
onChange
func
isDisabled
bool
isActive
bool
label
string
hint
oneOfType
string
node