PIN Input
Allows users to input a sequence of one-character alphanumeric inputs.
This component is derived from and would not have been possible without the work done by Input OTP by Guilherme Rodz.
Structure
API Reference
The root component which contains the pin-input.
Property | Type | Description |
---|---|---|
placeholder | string | The placeholder character to use for empty pin-inputs. Default: ○ |
value | string[] | The value of the pin-input. Default: undefined |
name | string | The name of the pin-input. This is used for form submission. Default: undefined |
disabled | boolean | Whether or not the pin-input is disabled. Default: false |
type | 'text' | 'password' | The type of the input. Use Default: text |
onValueChange | function | A callback function called when the pin-input value changes. Default: undefined |
asChild | boolean | Whether to use render delegation with this component or not. Default: false |
el | HTMLDivElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default: undefined |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
ids | object | The ids of the elements within the component, useful when you don't necessarily want to provide a custom ID, but still want access to the ID being assigned (if any). |
Data Attribute | Value | Description |
---|---|---|
data-pin-input-root | —— | Present on the root element. |
data-complete | —— | Present if the pin-input is complete. |
The input component which contains the pin-input.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default: false |
el | HTMLInputElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-pin-input-input | —— | Present on the input element. |
data-complete | —— | Present if the pin-input is complete. |
The hidden input component which contains the pin-input.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default: false |
el | HTMLInputElement | The underlying DOM element being rendered. You can bind to this to programatically interact with the element. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-pin-input-hidden-input | —— | Present on the hidden input element. |