Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chakra-ui/pin-input

Package Overview
Dependencies
Maintainers
3
Versions
444
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/pin-input

A React component optimized for entering sequences of digits

  • 2.0.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
470K
decreased by-5.93%
Maintainers
3
Weekly downloads
 
Created

What is @chakra-ui/pin-input?

@chakra-ui/pin-input is a component library for creating PIN input fields in React applications. It provides a set of components that make it easy to build PIN input forms with various customization options, such as managing focus, handling input values, and styling.

What are @chakra-ui/pin-input's main functionalities?

Basic PIN Input

This code demonstrates a basic PIN input with four fields. The `PinInput` component wraps around `PinInputField` components to create a PIN input form.

```jsx
import { PinInput, PinInputField } from '@chakra-ui/pin-input';

function BasicPinInput() {
  return (
    <PinInput>
      <PinInputField />
      <PinInputField />
      <PinInputField />
      <PinInputField />
    </PinInput>
  );
}
```

Controlled PIN Input

This code demonstrates a controlled PIN input where the value is managed by the component's state. The `value` and `onChange` props are used to control the input.

```jsx
import { useState } from 'react';
import { PinInput, PinInputField } from '@chakra-ui/pin-input';

function ControlledPinInput() {
  const [value, setValue] = useState('');

  return (
    <PinInput value={value} onChange={setValue}>
      <PinInputField />
      <PinInputField />
      <PinInputField />
      <PinInputField />
    </PinInput>
  );
}
```

Custom Length PIN Input

This code demonstrates a PIN input with a custom length of six fields. The `length` prop is used to specify the number of input fields.

```jsx
import { PinInput, PinInputField } from '@chakra-ui/pin-input';

function CustomLengthPinInput() {
  return (
    <PinInput size="lg" length={6}>
      <PinInputField />
      <PinInputField />
      <PinInputField />
      <PinInputField />
      <PinInputField />
      <PinInputField />
    </PinInput>
  );
}
```

Masked PIN Input

This code demonstrates a masked PIN input where the input values are hidden. The `type` prop is set to `password` to mask the input.

```jsx
import { PinInput, PinInputField } from '@chakra-ui/pin-input';

function MaskedPinInput() {
  return (
    <PinInput type="password">
      <PinInputField />
      <PinInputField />
      <PinInputField />
      <PinInputField />
    </PinInput>
  );
}
```

Other packages similar to @chakra-ui/pin-input

Keywords

FAQs

Package last updated on 26 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc