PullCord

A lamp pull cord. Drag the handle down and let go: the cord stretches, the handle snaps back with a small overshoot, and the bulb flips. Inputs.

Open playground

About

PullCord is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { PullCord } from "@ashutoshswamy/smoui" and set label, checked, onChange.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { PullCord } from "@ashutoshswamy/smoui";

<PullCord label="Lamp" onChange={setOn} />

Props 3

label

Accessible name.

string
checked / defaultChecked

Controlled or initial state.

booleandefault false
onChange

Called when the cord is pulled far enough.

(checked: boolean) => void