Switch

A labelled on/off toggle switch.

Import

import { Switch } from "@tarve/core";

Usage

Switch.tsx
import { Switch } from "@tarve/core";

let airplane = false;

<Switch
  label="Airplane mode"
  checked={airplane}
  onCheckedChange={(checked) => {
    airplane = checked;
  }}
/>

Props

PropTypeDefault
checked required boolean—
label required string—
disabled boolean—
onCheckedChange (checked: boolean) => void—

Common props

Shared by every component. See descriptions →

childrenhighlightidkeymotionFromonHighlightonPasteonTransitionEndrovingGroupstyle