Skip to main content

PinCode

A basic widget for getting pin code for verifications.

'use client';

import { PinCode } from 'rizzui/pin-code';

Default

The default style of PinCode component.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return (
<>
<PinCode />
</>
);
}

Variants

We have three different styles. You can select any of them using variant property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return (
<>
<PinCode variant="flat" />
<PinCode variant="outline" />
</>
);
}

Sizes

You can set different sizes of the PinCode using size property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return (
<>
<PinCode size="sm" />
<PinCode />
<PinCode size="lg" />
</>
);
}

With Mask

You can hide pin code value using mask property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return <PinCode mask={true} />;
}

With Placeholder

You can set custom placeholder using placeholder property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return <PinCode placeholder="😀" />;
}

With Length

You can set custom length of the PinCode using length property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return (
<>
<PinCode length={4} />
<PinCode length={5} />
</>
);
}

Disabled

You can disable the PinCode using disabled property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return <PinCode disabled />;
}

With Error Message

You can show the validation error message using error property.

'use client';

import { PinCode } from 'rizzui/pin-code';

export default function App() {
return <PinCode center={false} error="This field is required" />;
}

API Reference


PinCode Props

Here is the API documentation of the Pin Code component.

PropsTypeDescriptionDefault
setValuePincodeSetvaluePass setState to get back the pin code value__
typenumber textThis Pin Code component only supports these two types"text"
maskbooleanMask and unmask to hide and show pin codefalse
lengthnumberSet pin code length4
centerbooleanMake pin code horizontally centertrue
placeholderstringSet placeholder text"o"
variantPincodeVariantsThe variants of the component are:"outline"
sizePincodeSizesThe size of the component. "sm" is equivalent to the dense input styling."md"
errorstringShow error message using this prop__
inputClassNamestringAdd custom classes for the input field extra style__
errorClassNamestringThis prop allows you to customize the error message style__
classNamestringAdd custom classes to the root of the component__

Pincode Setvalue

type PincodeSetvalue = Dispatch<SetStateAction<string | number | undefined>>;

Pincode Variants

type PincodeVariants = 'outline' | 'flat';

Pincode Sizes

type PincodeSizes = 'sm' | 'md' | 'lg';