Loading preview
Copy Button
ButtonsCopies text to the clipboard and confirms with a check mark and a screen reader message.
A hanging lamp you switch by pulling its cord; it can toggle the page between light and dark mode.
npx shadcn@latest add @venusui/pull-cord-lampRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/pull-cord-lamp.tsxThe code behind the preview above.
pull-cord-lamp-demo.tsx
import { PullCordLamp } from "@/components/ui/pull-cord-lamp"
export default function PullCordLampDemo() {
return (
<div className="flex min-h-[26rem] w-full flex-col items-center">
<PullCordLamp controlsTheme label="Light (switches light and dark mode)" />
<p className="mt-auto text-sm text-muted-foreground">Pull the cord to switch between light and dark.</p>
</div>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| controlsTheme | boolean | false | Switch the page between light (lamp on) and dark (lamp off) by toggling .dark on <html>. |
| on, defaultOn | boolean | — | Controlled or initial state when not controlling the theme. |
| onToggle | (on: boolean) => void | — | Called after each pull. |
| label | string | "Light" | Accessible name for the cord. |
All <div> props.
pull-cord-lamp-swing keyframes.controlsTheme assumes shadcn's class-based dark mode (.dark on <html>).controlsTheme off and call its setTheme from onToggle, so the choice is saved.div.switch with aria-checked; a click, tap, Enter or Space toggles it, so dragging is optional.controlsTheme doesn't save the choice; save it yourself in onToggle, or use your theme library as described above.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.Copies text to the clipboard and confirms with a check mark and a screen reader message.
A heart toggle that pops and bursts when liked, with an optional count.
Cards arranged in a ring that turns in 3D, with buttons, arrow keys and announcements.