Component packs › Marble › Marble Switch

Marble Switch

Switch it and the track tips: a glass marble rolls down the groove, turning as it rolls, and bounces gently off the end.

Marble Switch is a toggle from Marble, a component pack with 6 marble controls: Controls made of glass marbles that roll, knock and settle like the real thing. Price: $2 for the whole pack.

Built with: gravity roll, no-slip spin, caustic shadow.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Marble Switch props

PropTypeDefaultDescription
checkedboolean
disabledboolean
labelstring
sizenumber
onChange(checked: boolean) => void
autoplaynumber | false

Methods on the ref

Use it in React

import MarbleSwitch from './MarbleSwitch';

<MarbleSwitch />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Marble

Good for: Toggle switches, Loaders and progress, Physics UI components.