components / 08

marked switch

the thumb moves because state changed. the border redraws because cheez noticed.

shadcnnpx shadcn@latest add berkantay/cheez/marked-switch
live

playground

on
size
label
character
on frame
interaction
on ink
interaction ink
state
<MarkedSwitch
  checked={true}
  checkedMark="rounded-box"
  interactionMark="loose-circle"
  character="rushed"
  size="medium"
  labelPosition="end"
  onCheckedChange={setChecked}
>
  human motion
</MarkedSwitch>
behavior

states

the frame carries interaction
off
hover
on
bubble
required
invalid
read only
disabled
composition

mark preferences

independent native fields
{
  "motion": true,
  "sound": false,
  "hints": true
}
reference

api

Base UI semantics, Cheez frame
partproptypedefaultpurpose
Switchcheckedbooleancontrolled on state
SwitchdefaultCheckedbooleanfalseuncontrolled initial state
SwitchonCheckedChangefunctionstate callback
SwitchcheckedMarkCheezType"rounded-box"on-state frame
SwitchinteractionMarkCheezType"loose-circle"hover and focus frame
SwitchcheckedColorstring"#b7ff3c"on-state ink
SwitchinteractionColorstring"#8f74ff"interaction ink
Switchcharacter"calm" | "rushed" | "chaotic""rushed"drawing personality
Switchsize"small" | "medium" | "large""medium"control scale
SwitchlabelPosition"start" | "end""end"label placement
SwitchdescriptionReactNodeaccessible helper text
SwitcherrorReactNodeinvalid message and frame
Switchnamestringnative form field name
Switchvaluestring"on"submitted on value
SwitchuncheckedValuestringoptional submitted off value
Switchrequiredbooleanfalserequired on state
Switchdisabledbooleanfalsedisabled state
SwitchreadOnlybooleanfalseread-only state

behavior notes

  • Space toggles the focused switch
  • the root exposes native switch semantics
  • the thumb transition respects reduced motion
  • checked and unchecked values can both join form data
  • disabled switches never draw
  • the label and description remain one click target