1 viewer
Back to Components
Component · Input

Switch

Accessible binary toggle control.

Category
Input
Slots
6
States
4
Writer
Shared
cre8.primitive.switch

Preview

Live renderShared SSR + WASM writers
<Switch
  checked={true}
  label="Realtime WebSocket Streaming (:8788)"
  name="realtime_stream"
/>

Anatomy

The named parts of the rendered markup. Recipes style these hooks, and every renderer keeps them stable.

SlotDOM class
root.primitive-switch
label.primitive-switch__label
input.primitive-switch__input
text.primitive-switch__text
help.primitive-switch__help
error.primitive-switch__error
6 rows
Modifier
primitive-switch--{state}
State attribute
data-statefrom the checkedState prop
Role
switch (on the input)

States and platforms

The states the contract publishes, the platforms it declares, and the style recipes that dress it.

States
checkeddisabledrequiredinvalid
Platforms
webnativeruntime-node
Recipes
unstyledruntime-console

Renderers

Shared writer
Switch renders through the one writer the server and the WASM DOM share, so both emit the same markup.

Every tag in the example above renders through a shared writer.

Declared adapters. A status is the manifest's declaration, not a measured parity result.

TargetRendererStatus
webreactexperimental
runtime-nodeview-nodeready
ssrhtml-form-controlready
terminalterminal-form-controlplanned
nativenative-adapterexperimental
5 rows

Accessibility

Uses switch semantics with explicit label and state wiring.

  • Checked and invalid states remain available to assistive tech.
  • Label, help text, and error text are linked through ids.