Skip to content
Ballpoint

Switch

A pill pulled in one motion, shaded in with the pen as the thumb slides across.

From shadcn/ui
Built on Base UI Switch

Strokes draw themselves the first time they scroll into view.

Installation

pnpm dlx shadcn@latest add @ballpoint/switch

Usage

tsx
import { Label } from "@/components/ui/label"
import { Switch } from "@/components/ui/switch"

<Label>
  <Switch defaultChecked />
  Draw things in
</Label>

Examples

In a card

A controlled switch in a settings card, and a disabled one beside it.

Notifications
Reminders are on.

An email the day before.

Coming soon.

Sizes and states

Three sizes, disabled on and off, and invalid.

In a form

Switches with descriptions, one required, and an error until it is on.

Required before we can post you a notebook.

One email a month, hand-written in spirit.

API reference

size
default "default"
"sm" | "default" | "lg"

Track size: 32, 44 or 56px wide.

seed
string | number

Pins the drawing.

Every other prop goes to Base UI's Switch.

Pen settings

The drawing also takes draw, roughness, passes, fill, weight and speed, as props or from the nearest InkProvider. What each one does.