# PinInput (@limerdev/zest) A code typed into separate boxes, as one input underneath: `` (`maxlength`, `bind:value`, `pattern`, `onComplete`) draws its boxes in one row. To group them, its `children` snippet gets the `cells`, each drawn as a `PinInput.Cell`; `PinInput.Group` joins cells into one row and `PinInput.Separator` puts a dash between groups. Typing moves on, Backspace moves back, pasting fills all boxes, and password managers and one-time-code autofill work. Inside a `Field` the input is labelled, described and marked invalid by the Field. - Category: Data input - Import: `import { PinInput } from '@limerdev/zest'` - Bits UI: `PinInput`, https://bits-ui.com/docs/components/pin-input - Exports: `PinInput.Root`, `PinInput.Cell`, `PinInput.Group`, `PinInput.Separator` - Use for: A verification or one-time code of a fixed length. - Don't: Passwords or text of no fixed length: use `Input`. ```svelte Verification code ``` Props of `PinInput.Root`: - `disabled` (`boolean`): Whether the input is disabled - `inputId` (`string`): Optionally provide an ID to apply to the hidden input element. - `inputRef` (`HTMLInputElement | null`): The underlying hidden `` element. Bind to call `focus()`, read selection, etc. - `maxlength` (`number`, required): The max length of the input. - `onComplete` (`((...args: any[]) => void)`): A callback function that is called when the input is completely filled. - `onValueChange` (`OnChangeFn`): A callback function that is called when the value of the input changes. - `pasteTransformer` (`((text: string) => string)`): A callback function that is called when the user pastes text into the input. It receives the pasted text as an argument, and should return the sanitized text. Use this function to clean up the pasted text, like removing hyphens or other characters that should not make it into the input. - `pushPasswordManagerStrategy` (`"none" | "increase-width"`): How to handle the input when a password manager is detected. - `textalign` (`"right" | "left" | "center"`, default `"left"`): Customize the alignment of the text within in the input. - `value` (`string`, default `''`, bindable): The value of the input. Props of `PinInput.Cell`: - `cell` (`PinInputCell`, required): This specific cell, which is provided by the `cells` snippet prop from the `PinInput.Root` component. Example: Basic Six boxes. Pasting a code fills them all. ```svelte Verification code Sent to your phone. {code.length}/6 ``` Example: Groups The children snippet gets the cells, to split them into groups with a separator. ```svelte Recovery code {#snippet children({ cells })} {#each cells.slice(0, 3) as cell, index (index)} {/each} {#each cells.slice(3) as cell, index (index)} {/each} {/snippet} ```