Skip to content

Otp theming ​

The values listed below are exposed as --rozie-otp-* custom properties, each with a built-in fallback, so Otp works with zero configuration and re-skins by remapping tokens. The structural rules compile per-leaf and are not consumer-overridable.

css
:root {
  --rozie-otp-gap: 0.5rem;
  --rozie-otp-accent: #0066cc;
  --rozie-otp-cell-size: 2.75rem;
  --rozie-otp-focus-ring-width: 3px;
}

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

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)

Defaulted where Otp reads them ​

Public, but declared nowhere by base.css: the fallback below applies only while no scope sets the token, and it is resolved at the component itself — so it follows a value set on any ancestor (a token it defaults to included).

TokenDefault
--rozie-otp-filled-border-colorvar(--rozie-otp-accent, #0066cc)

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.