OTP
DOtp renders daisyUI's CSS-only
4-digit code— Count generates the boxes and the input; @bind-Value reports the typed code
Typed: —
<DOtp Count="4" Color="DaisyColor.Primary" @bind-Value="_code" />
<p class="mt-3 text-sm opacity-70">Typed: <strong>@(_code is { Length: > 0 } ? _code : "—")</strong></p>
@code {
private string? _code;
}6 digits, joined— Joined connects the boxes (otp-joined)
<DOtp Count="6" />
<DOtp Count="6" Joined="true" Color="DaisyColor.Neutral" />Sizes— otp-xs to otp-xl (Medium emits no class)
<DOtp Count="4" Size="DaisySize.ExtraSmall" />
<DOtp Count="4" Size="DaisySize.Small" />
<DOtp Count="4" />
<DOtp Count="4" Size="DaisySize.Large" />
<DOtp Count="4" Size="DaisySize.ExtraLarge" />Colors and disabled
<DOtp Count="4" Color="DaisyColor.Primary" />
<DOtp Count="4" Color="DaisyColor.Secondary" />
<DOtp Count="4" Color="DaisyColor.Accent" />
<DOtp Count="4" Color="DaisyColor.Info" />
<DOtp Count="4" Color="DaisyColor.Success" />
<DOtp Count="4" Color="DaisyColor.Warning" />
<DOtp Count="4" Color="DaisyColor.Error" />
<DOtp Count="4" Color="DaisyColor.Error" Value="1234" Disabled="true" />Bring your own markup— Omit Count and place the boxes plus one input as direct children
<DOtp Color="DaisyColor.Info">
<span></span>
<span></span>
<span></span>
<input type="text" autocomplete="one-time-code" inputmode="numeric" maxlength="3" pattern="[0-9]{3}" required />
</DOtp>API
DOtp
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Count | int? | — | — | Number of character boxes to render, followed by a single hidden input ( maxlength / pattern set to match). daisyUI sizes the container from the box count (up to 8). Omit to supply the spans and input yourself via ChildContent . |
| Value | string | — | @bind-Value | The code typed so far (use with @bind-Value ). Only applies to Count mode. |
| Size | DaisySize | Medium | — | Sizes the boxes via daisyUI (otp-xs, otp-sm, otp-lg, otp-xl). Default: otp-md (no class). ExtraSmallSmallMediumLargeExtraLarge |
| Color | DaisyColor | Default | — | Border color of the boxes (otp-primary, otp-error, ...). Default: theme input color. DefaultPrimarySecondaryAccentInfoSuccessWarningErrorGhostNeutral |
| Joined | bool | False | — | Connects the character boxes together ( otp-joined ). |
| Disabled | bool | False | — | Disables the input (daisyUI dims the boxes via :has(>input:disabled) ). |
| ChildContent | RenderFragment | — | — | Custom content for full control: place exactly N empty <span> boxes and one <input> (with matching maxlength / pattern ) as direct children. Ignored when Count is set. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |