Skip to content

PinInput

The pin-input component.

Importing

ts
import "@tapsioss/web-components/pin-input";
ts
import { PinInput } from "@tapsioss/react-components/PinInput";

Component Usage

html
<tapsi-pin-input></tapsi-pin-input>
tsx
<PinInput />

Properties

NameDescriptionTypeDefault Value
valueThe current value of the input. It is always a string.string""
nameThe HTML name to use in form submission.string""
disabledWhether or not the element is disabled.booleanfalse
requiredIndicates that the user must specify a value for the input before the owning form can be submitted and will render an error state when reportValidity() is invoked when value is empty. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/requiredbooleanfalse
readonlyIndicates whether or not a user should be able to edit the input's value. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonlybooleanfalse
placeholderDefines the text displayed in the input when it has no value. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholderstring""
autocompleteDescribes what, if any, type of autocomplete functionality the input should provide. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocompletestring""
autofocusIndicates that the element should be focused on page load. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocusbooleanfalse
supporting-textConveys additional information below the text input, such as how it should be used.string""
errorGets or sets whether or not the text input is in a visually invalid state. This error state overrides the error state controlled by reportValidity().booleanfalse
error-textThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. This error message overrides the error message displayed by reportValidity().string""
labelThe label of the input. - If the hideLabel property is true, the label will be hidden visually but still accessible to screen readers. - Otherwise, a visible label element will be rendered. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelstring""
labelledbyIdentifies the element (or elements) that labels the input. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledbystring""
hide-labelWhether to hide the label or not.booleanfalse
maskedDetermines whether input values should be masked or not.booleanfalse
pinsThe number of inputs. Defaults to 4.number4
pinlengthThe number of each input's length. Defaults to 1.number1
typeDetermines which values can be entered. Defaults to "alphanumeric"."alphanumeric" | "numeric""alphanumeric"

Events

NameDescriptionType
completeFires when all the pins have values.CompleteEvent

TIP

You can import custom event names:

ts
import { 
  CompleteEvent
} from "@tapsioss/web-components/pin-input";

element.addEventListener(CompleteEvent.type, handleTapsiPinInputComplete);
tsx
import { 
  PinInputCompleteEvent
} from "@tapsioss/react-components";


// ...

<PinInput
  onCompleteEvent={(e: PinInputCompleteEvent) => {...}}
/>