Pull Cord - React Component | Kokonut UI
Pull Cord
A lamp switch you pull on a swinging cord, built with React and a rope simulation.
Installation
Pull Cord is a free, open-source React component in the Kokonut UI Buttons collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/pull-cord.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/pull-cord
Usage
import PullCord from "@/components/kokonutui/pull-cord";
export default function Example() {
return <PullCord />;
}
Props
checked
boolean- Controlled state.
defaultChecked
booleanDefaulttrue- Initial state when uncontrolled.
onCheckedChange
(checked: boolean) => void
label
stringDefault"Desk lamp"- Accessible name of the switch.
className
string- Extra classes for the root element.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.