Pin Input
<afp-pin-input>
A PIN input component for entering multi-digit codes.
Examples #
Sizes #
Use the size attribute to adjust the size of the PIN input fields.
Shapes #
Use the shape attribute to adjust the shape of the PIN input fields.
Type of input #
Use the type attribute to control which characters are allowed in the PIN input.
numeric(default): digits only (0–9)alphanumeric: letters and digitsalpha: letters
Placeholder #
Use the placeholder attribute to display a hint character in each PIN field.
Disabled state #
Use the disabled attribute to disable all input fields at once.
Invalid state #
Use the invalid attribute to mark the PIN as invalid and display an error message below the fields.
With preset value #
Use the value attribute to prefill the PIN fields.
Properties
Learn more about properties.
| Name | Description | Reflects | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
length
|
Number of PIN digits.
Type
number
Default
6 |
|
||||||||||
type
|
Type of input allowed.
Type
PinInputType
Default
PinInputType.NUMERIC |
|
||||||||||
size
|
Size of the input fields.
Type
AfpSize
Default
AfpSize.MEDIUM |
|
||||||||||
shape
|
Shape of the input fields.
Type
AfpShape
Default
AfpShape.ROUNDED |
|
||||||||||
value
|
Complete PIN value as a single string.
Type
string
Default
'' |
|||||||||||
disabled
|
Disables all inputs.
Type
boolean
Default
false |
|
||||||||||
invalid
|
Error message shown below the inputs.
Type
string | undefined
|
|
||||||||||
placeholder
|
Placeholder for each input.
Type
string
Default
'' |
Events
Learn more about events.
| Name | Return | Description |
|---|---|---|
afp-value-changed
|
string
|
Emitted whenever the PIN value changes.
|
afp-pin-complete
|
string
|
Emitted when all PIN digits have been filled.
|
Slots
Learn more about slots.
| Name | Description |
|---|---|
default
|
The default slot.
|
Internationalization
Learn more about internationalization.
| Key | Description |
|---|---|
pin-input.digit
|
aria-label for each digit input
|
CSS Parts
Learn more about CSS Parts.
| Name | Description | Selector |
|---|---|---|
base
|
The component's base wrapper.
|
::part(base)
|
input
|
The individual input fields.
|
::part(input)
|
invalid
|
The error message container.
|
::part(invalid)
|
CSS Custom Properties
| Name | Description | Default |
|---|---|---|
--afp-pin-input-gap
|
Gap between individual input fields.
|
--afp-space-s
|
Dependencies
The component automatically brings in the listed items, including any nested dependencies that may exist.
Importing
Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.
import '@afp-design-system/core/dist/components/pin-input/pin-input.js';