Lock Toggle

A padlock whose shackle drops shut and swings open again.

Preview

"use client";

import { LockToggle } from "@/components/motion/lock-toggle";

export function LockToggleUsage() {
  return <LockToggle />;
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/lock-toggle

API Reference

locked?
boolean

Whether the padlock is locked, for controlled use.

Default—
defaultLocked?
boolean

Whether it starts locked when uncontrolled. Default: true

Defaulttrue
onLockedChange?
((locked: boolean) => void)

Called with the next state when the padlock is toggled.

Default—
showLabel?
boolean

Show Locked / Unlocked next to the padlock.

Defaulttrue
labels?
Partial<{ lock: string; locked: string; unlocked: string; }>

Override any built-in string, e.g. for translation.

Default—
sound?
boolean

Play a low press on lock and a light tap on unlock. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

Updated