Skip to content

Otp theming

Every cosmetic value Otp renders is a --rozie-otp-* custom property with a built-in fallback, so the component works with zero configuration and stays fully re-skinnable. The structural rules compile per-leaf and are not consumer-overridable — only the values below flow through tokens.

css
.rozie-otp {
  --rozie-otp-gap: 0.5rem;
  --rozie-otp-accent: #0066cc;
  --rozie-otp-cell-size: 2.75rem;
  --rozie-otp-filled-border-color: var(--rozie-otp-accent);
}

Tokens

layout / typography

TokenDefault
--rozie-otp-gap0.5rem
--rozie-otp-fontinherit

accent — the single color most consumers will set; caret + focus + filled border derive from it

TokenDefault
--rozie-otp-accent#0066cc

per-cell box model

TokenDefault
--rozie-otp-cell-size2.75rem
--rozie-otp-font-size1.25rem
--rozie-otp-font-weight600
--rozie-otp-colorinherit
--rozie-otp-bg#fff
--rozie-otp-border-width1px
--rozie-otp-border-colorrgba(0, 0, 0, 0.25)
--rozie-otp-radius0.5rem

filled cell (a cell that already holds a character)

TokenDefault
--rozie-otp-filled-border-colorvar(--rozie-otp-accent)

focus ring

TokenDefault
--rozie-otp-focus-ring-width3px
--rozie-otp-focus-ring-colorrgba(0, 102, 204, 0.25)

placeholder character color

TokenDefault
--rozie-otp-placeholder-colorrgba(0, 0, 0, 0.3)

disabled

TokenDefault
--rozie-otp-disabled-opacity0.55
--rozie-otp-disabled-bgrgba(0, 0, 0, 0.04)

Design-system bridges

Each package ships token presets that map Otp's tokens onto a known design system's published CSS variables — import base.css first, then a bridge:

ts
import '@rozie-ui/otp-react/themes/base.css';
import '@rozie-ui/otp-react/themes/bootstrap.css';
import '@rozie-ui/otp-react/themes/material.css';
import '@rozie-ui/otp-react/themes/shadcn.css';

See also

Pre-1.0 — APIs may change between minor versions.