0.0.0-alpha.3 • Published 11 months ago

@chakra-ui/c-pin-input v0.0.0-alpha.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@chakra-ui/c-pin-input

The pin input component is similar to the input component but is optimized for entering sequences of digits quickly

Installation

yarn add @chakra-ui/c-pin-input
# or
npm i @chakra-ui/c-pin-input

Import

This package exports the following components :

  • CPinInput : The wrapper for all the field elements.
  • CPinInputField: The field element.
  • CPinInputClearButton: The button to clear all the fields.

Usage :

Basic :

<c-pin-input :value="['1', '2']">
    <c-pin-input-field />
    <c-pin-input-field />
    <c-pin-input-field />
    <c-pin-input-field />
</c-pin-input>

Event handling :

The CPinInput will trigger 3 events :

  • change : Whenever the value changes. It also returns the new value of the input as an array in an object. { value: [] }
  • complete: Trigger uppon completion of all the fields. Returns the value as an array, but also as a string. { value: [], valueAsString: '123' }
  • invalid: Triggers if the input is invalid.
<c-pin-input @change="triggerChange" @complete="complete">
    <c-pin-input-field />
    <c-pin-input-field />
    <c-pin-input-field />
    <c-pin-input-field />
</c-pin-input>

Props

value: Value of the input (Type: Array). placeholder: Changes the default placeholder (o) blurOnComplete: To blur the last input when the user completes the input. type: "alphanumeric" | "numeric" otp: To trigger smartphone OTP suggestion. dir: "rtl" | "ltr" . (Right-To-Left or Left-To-Right) spacing: Space between the fields. mask : Masks the value of the input by changing their type to "password"

2.1.0-beta.11

1 year ago

2.1.0-beta.10

1 year ago

2.1.0-beta.5

1 year ago

2.1.0-beta.7

1 year ago

2.1.0-beta.6

1 year ago

2.1.0-beta.4

1 year ago

2.1.0-beta.3

1 year ago

2.1.0-beta.2

1 year ago

2.1.0-beta.1

1 year ago

1.0.0-beta.2

1 year ago

1.0.0-beta.1

1 year ago

1.0.0-beta.0

1 year ago

0.0.0-alpha.3

1 year ago

0.0.0-alpha.1

1 year ago