Skip to content
caliper ui pro docs

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.

Pro

Locked

Not opened yet.

When to use

  • Access codes, vaults, escape-room and game screens.
  • A playful way to ask for a short code in a demo or onboarding.

When not to use

  • Real security; the code is in the page. Use it for delight, not protection.
  • Long codes; past six digits use `OtpInput`.

Installation

terminal
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.

API reference

CombinationLock

4 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
code *string—The digits that open it, 3 to 6 of them: "4821".
onUnlock(() => void)—
onLock(() => void)—Called when the lock is closed again.
labelstring"Combination lock"Names the lock, e.g. "Vault".

wheelDigit

0 props

No props of its own; it accepts the native props of its root element.

Keyboard

↑
Moves to the previous item or value.
PageUp
Moves by a larger step, or to the previous page.
↓
Moves to the next item or value.
PageDown
Moves by a larger step, or to the next page.

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.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/combination-lock.md

The index of every part is at /llms.txt.

More in Changing values