Wire the value to your theme, and compose the glow, the cord, and the handle at the top edge of the page.
theme-cord.tsx
PullCord
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| value | "dark""light" | — | The theme the cord shows. Controlled: a pull asks for the other value. |
| default | "dark""light" | "light" | |
| on | — | Called at the moment of the switch, with the new value. | |
| disabled | boolean | false | Stops new pulls. The bead still swings back to rest. |
| length | number | PULL_CORD.length | The rest length of the rope in px, from the top edge to the bead. Default 96. |
| driver | — | Drives a pull from code (DragDriver, no item): a staged scene or a test takes the bead, and the rope, the switch, and the spring back work as for a finger. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
PullCordGlow
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
PullCordCord
<svg>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <svg> attributes | — | Every other attribute goes to the <svg>, with a ref. |
PullCordHandle
<button>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| style | CSSProperties | — | |
From Base UIButtonBase UI docs | |||
| focusable | boolean | false | Whether the button should be focusable when disabled. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| native | boolean | true | Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>). |
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. |
| Tab | Moves the focus to the bead. |
|---|---|
| EnterorSpace | Plays one pull and switches between light and dark. |











