2.1.0 • Published 10 months ago

@chakra-ui/pin-input v2.1.0

Weekly downloads
61,234
License
MIT
Repository
github
Last release
10 months ago

Pin Input

The PinInput component is optimized for entering sequences of digits. The most common application is for entering single-use security codes. It is optimized for entering digits quickly.

Installation

yarn add @chakra-ui/pin-input

or

npm i @chakra-ui/pin-input

Import component

import {
  PinInput,
  PinInputField,
  usePinInput,
  usePinInputField,
} from "@chakra-ui/pin-input"

Usage

Chakra UI exports two primary components, PinInput and PinInputField to compose a PinInput component. Chakra UI also provides hooks to can create a custom PinInput component.

<PinInput defaultValue="234">
  <PinInputField />
  <PinInputField />
  <PinInputField />
</PinInput>
function PinInputHookExample() {
  const context = usePinInput({ autoFocus: true })
  const input1 = usePinInputField({ context })
  const input2 = usePinInputField({ context })
  const input3 = usePinInputField({ context })
  const input4 = usePinInputField({ context })

  return (
    <div>
      <input style={style} {...input1} />
      <input style={style} {...input2} />
      <input style={style} {...input3} />
      <input style={style} {...input4} />
    </div>
  )
}

Sizes

<PinInput size="lg" defaultValue="234">
  <PinInputField />
  <PinInputField />
  <PinInputField />
</PinInput>

Controlled

function ControlledPinInput() {
  const [value, setValue] = React.useState("")

  const handleChange = (value: string) => {
    setValue(value)
  }

  const handleComplete = (value: string) => {
    console.log(value)
  }
  return (
    <PinInput value={value} onChange={handleChange} onComplete={handleComplete}>
      <PinInputField />
      <PinInputField />
      <PinInputField />
    </PinInput>
  )
}
2.1.0

10 months ago

2.0.20

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.15

2 years ago

2.0.16

1 year ago

2.0.17

1 year ago

2.0.14

2 years ago

2.0.13

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

1.7.11

2 years ago

2.0.10

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.0-next.2

2 years ago

2.0.0-next.3

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.7.9

2 years ago

2.0.0-next.0

2 years ago

2.0.0-next.1

2 years ago

1.7.10

2 years ago

1.7.8

2 years ago

1.7.7

2 years ago

1.7.6

2 years ago

1.7.5

2 years ago

1.7.4

2 years ago

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.7

2 years ago

1.6.6

3 years ago

1.6.5

3 years ago

1.6.4-next.1

3 years ago

1.6.4

3 years ago

1.6.4-next.0

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-rc.8

4 years ago

1.0.0-rc.7

4 years ago

1.0.0-rc.6

4 years ago

1.0.0-rc.5

4 years ago

1.0.0-rc.4

4 years ago

1.0.0-rc.3

4 years ago

1.0.0-rc.2

4 years ago

1.0.0-rc.1

4 years ago

1.0.0-next.7

4 years ago

1.0.0-rc.0

4 years ago

1.0.0-next.5

4 years ago

1.0.0-next.6

4 years ago

1.0.0-next.4

4 years ago

1.0.0-next.3

4 years ago

1.0.0-next.2

4 years ago

1.0.0-next.1

4 years ago

1.0.0-next.0

4 years ago