Pro
Combination lock
A combination padlock with number wheels. Roll each wheel by dragging, pressing or with the arrow keys; when the wheels read the code the shackle lifts and swings free.
pnpm dlx shadcn@latest add @caliper/combination-lockWhen to use
Use it for
- Access codes, vaults, escape-room and game screens.
- A playful way to ask for a short code in a demo or onboarding.
Skip it when
- Real security; the code is in the page. Use it for delight, not protection.
- Long codes; past six digits use `OtpInput`.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- Wheels wrap
- Each wheel keeps counting in either direction, and the digits above and below fade so the wrap is never seen.
- No feedback on wrong digits
- It gives no count of correct digits and no tries; the code is the lock.
Usage
- Spin buttons
- Each wheel is a spin button with a name and a value, takes arrow keys and typed digits, and the state is announced.
Installation
pnpm dlx shadcn@latest add @caliper/combination-lock
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from CombinationLock and wheelDigit.
import { CombinationLock, wheelDigit } from "@/components/ui/combination-lock"
The worked example comes with Pro
The 25-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
CombinationLock
component
Also accepts the native props of its root element and a ref.
wheelDigit
component
No props of its own; it accepts the native props of its root element.
Accessibility
It exposes spinbutton, group and status semantics, with aria-label, aria-valuemin, aria-valuemax, aria-valuenow and aria-hidden kept in step with state. Changes that matter are announced through a live region.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.
Related
- OTP inputA segmented field for one-time codes with paste support and status.
- Pin padA PIN entry: dots fill as digits go in, a wrong code shakes and clears with a reason, and a right one settles green. Keypad or keyboard.
- Wheel pickerA scrolling wheel for choosing one value, with keyboard and wheel support.