OTP
Enter or paste a verification code into clearly separated cells.
Preview
Change the example value; the preview reports the current state.
Enter the six-digit code sent to your email.
Example
<.otp id="code" name="code" length={6} />
API contract
otp/1
uses declared Phoenix attributes and slots. This table is generated from the compiled component metadata.
| Attribute | Type | Required | Default | Accepted values |
|---|---|---|---|---|
id |
:string |
Yes | — |
Any value matching the declared type |
name |
:string |
Yes | — |
Any value matching the declared type |
length |
:integer |
No | 6 |
Any value matching the declared type |
label |
:string |
No | "One-time password" |
Any value matching the declared type |
size |
:atom |
No | nil |
[nil, :xs, :sm, :md, :lg, :xl] |
color |
:atom |
No | nil |
[nil, :neutral, :primary, :secondary, :accent, :info, :success, :warning, :error] |
joined |
:boolean |
No | false |
Any value matching the declared type |
required |
:boolean |
No | true |
Any value matching the declared type |
class |
:any |
No | nil |
Any value matching the declared type |
rest |
:global |
No | — |
Any value matching the declared type |
States and behavior
Default and caller-supplied variants preserve semantic daisyUI colors and additive classes.
Keyboard and accessibility
Behavioral tests
These automated checks are applied to this component by the package and documentation test suites.
-
ExUnit
OTP metadata and bounds
Renders the configured number of cells, matching maxlength and numeric pattern, and rejects unsupported lengths.
test/vaylan_ui/catalog_test.exs -
Browser
Rendered interaction
Confirms the visible cell count and native maxlength and pattern metadata.
examples/docs/assets/test/browser-smoke.mjs -
Docs
Preview behavior contract
Classified as input. Change the example value; the preview reports the current state.
examples/docs/test/vaylan_ui_docs_web/controllers/page_controller_test.exs -
Docs
Stable public component page
Renders the component name, example, API contract, accepted values, and keyboard and accessibility guidance at its stable URL.
examples/docs/test/vaylan_ui_docs_web/controllers/page_controller_test.exs