Skip to content
Form PinInput

PinInput

One box per character, with auto-advance and paste support.

On this page

Examples

Code and masked PIN

Paste a code into any box to fill them all.

Code: none

Razor
<div class="flex flex-col items-start gap-4">
    <KlyFormField Label="Verification code" Help="Paste a code into any box to fill them all.">
        <KlyPinInput Length="6" @bind-Value="_code" />
    </KlyFormField>
    <KlyFormField Label="Secret PIN">
        <KlyPinInput Length="4" Mask Type="PinInputType.Alphanumeric" Size="KlySize.Lg" />
    </KlyFormField>
    <p class="text-sm text-(--klyroo-text-muted)" data-testid="pin-state">Code: @(string.IsNullOrEmpty(_code) ? "none" : _code)</p>
</div>

@code {
    private string? _code;
}

API

KlyPinInput

One-time code input made of separate cells, with paste support, numeric or alphanumeric.

Parameters

Name Type Default Description
AriaLabel string Accessible name of the group when no KlyFormField label is around.
Class string Classes added to the root element, merged last so they win over the theme.
Color KlyColor "primary" Semantic color of the control: a built-in KlyColor or the name of a color you defined. When not set, Color applies, else primary. Values: primary, secondary, success, info, warning, error, neutral.
Disabled bool false Disables the control: it cannot be focused or changed and is not submitted.
Id string The id of the native control. Defaults to the one of the enclosing KlyFormField , else a generated one.
Length int 5 Number of boxes.
Mask bool false Hides the characters, as in a password field.
Name string Form field name outside an EditForm . Inside one, the name comes from the bound expression.
Required bool false Marks the control as required, for the browser and for assistive technology.
Size KlySize? Defaults to the size of the enclosing KlyFormField , or medium. Values: Xs, Sm, Md, Lg, Xl.
Type PinInputType PinInputType.Numeric Characters the cells accept: Numeric or Alphanumeric . Defaults to numeric. Values: Numeric, Alphanumeric.
Ui PinInputUi Per-instance class overrides of the slots of the pin input, see PinInputUi . They are merged after the theme and the Class parameter wins on the root slot.
Value (@bind-Value) string The value of the control. Bind it with @bind-Value .
ValueExpression Expression<Func<string>> The expression of the bound field. The compiler sets it with @bind-Value , and validation uses it to find the field.
Variant FieldVariant FieldVariant.Outline Look of the field: Outline , Soft , Subtle , Ghost or None . Values: Outline, Soft, Subtle, Ghost, None.

Ui slots

Ui takes a PinInputUi with one class string per slot, merged after the theme.

Slot Styles
Root Classes merged into the root slot of KlyPinInput , after the theme and the app configuration.
Cell Classes merged into the cell slot of KlyPinInput , after the theme and the app configuration.