Code
In context
Install · Free Web Component
One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.
The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:
Pro · React + TypeScript Pro
One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.
- React component (controlled or uncontrolled) with TypeScript types,
onChangeandonComplete, and the full source - Sunset, Mint and Mono tints, plus custom tints from Brand Fit
- The vanilla Web Component with every tint, a demo page, README and license
Attributes & props
| Name | Type | Default | Description |
|---|---|---|---|
| length | number | 6 | Number of cells (1–12). |
| value | string | '' | The code so far. Fires change as it is typed and complete when every cell is filled. |
| type | 'numeric' | 'text' | 'numeric' | Digits only, or letters and digits (upper-cased) for invite and promo codes. |
| mask | boolean | off | Shows dots instead of the characters, for a PIN. |
| group | number | 0 | Puts a separator after every N cells: 3 gives 123 – 456. |
| status | 'idle' | 'error' | 'success' | 'idle' | Set it after you check the code: error shakes the row and turns the glow coral, success turns it green. |
| size | number (px) | 52 | Cell width; the height, gaps and type scale with it. |
| theme | 'light' | 'dark' | 'light' | White porcelain or dark wells. |
| name | string | — | Form field name: the code is submitted with the surrounding form. |
| label | string | 'Verification code' | Accessible name of the field. aria-label in React. |
| autofocus / disabled | boolean | off | Focus it on load; dim it and ignore input. |
| sound | boolean | off | A porcelain tap per character, rising along the row, and a chime when complete (plus a tap of vibration on phones). Also on for everything inside an element with data-ui-sound="on". |
| tint Pro | 'aurora' | 'sunset' | 'mint' | 'mono' | object | 'aurora' | Glow colours, or a custom tint. Free build ships Aurora only. |
There is one real input under the cells, so pasting a code, the SMS suggestion on iOS and Android (autocomplete="one-time-code"), password managers and screen readers behave as they do on a plain field. Backspace removes the last character. Clear it by setting value to an empty string (or clear() on the element) after an error. Everything is CSS — no WebGL, no canvas — and reduced motion keeps the tiles and glow but drops the hop, the wave and the shake.
More components
- Tide Slide
- Pearl Dial
- Nova Rating
- Pearl Check
- Pearl Input
- Pearl Select
- Pearl Accordion
- Pearl Calendar
- Pearl Chip
- Glass Dock
- Pearl Slider
- Pearl Segmented
- Aurora Ring
- Glass Toggle
- Pearl Loader
- Ink Sphere
- Frost Card
- Holo Card
- Stream Text
- Lens Compare
- Glass Toast
- Glass Sheet
- Glass Tip
- Glass Nav
- Pearl Tabs
- Glass Command
- Halo Avatar
- Pearl Steps
- Pearl Skeleton
- Pearl Table
- Pearl Empty
- Roll Counter
- Glass Marquee
- Reveal Text
- Mesh Gradient
- Silk Waves
- Dot Field
- Plasma Orb
- Voice Wave
- Plush Buddy
- Gummy Agent
- Glass Tabbar
- Glass Menu
- Pearl Pricing
- Glass Bento
- Quote Wall
- Glass Cta
- Magnet Button
- Beam Border
- Spotlight Card
- Scratch Reveal
- Glass Sidebar
- Pearl Pagination
- Pearl Breadcrumb
- Liquid Metal Button
- Mercury Orb
- Prompt Input
- Voice Orb
- Firefly Button
- Pearl Button
- Alien Face
- Prism Button
- Liquid Carousel
- Orbit Carousel
- Deck Carousel