Search
Search for a page

Switch

A highly realistic toggle controller that mimics the organic mechanical inertia of native iOS controls.

bunx shadcn-svelte@latest add https://ui.grgurevic.click/r/switch.json

Usage

A basic on/off toggle switch. Drag the thumb left or right to feel the spring physics.

Disabled

Switches can be disabled to prevent user interaction.

Best practices

The best practices when using toggle switches.

  • Use toggle switches only for binary states that take effect immediately.
  • Pair each switch with a clear text label indicating what it controls. The logoList component provides a purpose-built slot for this pattern.
  • Position the switch toggle to the right side of list rows or text labels.
  • Disable input actions programmatically when required parent fields are empty. For irreversible actions, show a logoDialog confirmation instead.

Props

The props available for the Switch component.

PropTypeDefaultDescription
checkedbooleanfalseTwo-way bindable state property indicating toggled state.
disabledbooleanfalseDisables clicks and pointer listeners while opacity-scaling down.
liquidGlassbooleanfalseEnables physical liquid glass refraction (Chromium only).
refractiveIndexnumber1.5IOR of glass curvature. Range 1.0 (air) to 2.4.
bezelWidthnumber10Depth of bezel refraction zone (px).
displacementScalenumber15Intensity of physical refraction offset.
Previous Slider
Give feedback