Argent

Switch

Turns a setting on or off straight away.

import { Switch } from '@rajatweb/argent'

<Switch label="Notifications" defaultChecked onCheckedChange={save} />

Props

PropTypeDefaultWhat it does
label requiredstring
checkedboolean
defaultCheckedboolean
disabledboolean
hintstring
onCheckedChange(checked: boolean) => void

Accessibility

  • A bar marks "on", so it never depends on colour.

Do

  • Apply the change at once.

Don’t

  • Make people press Save afterwards.