Pin Input

Allows a sequence of one-character inputs.

Preview
Code

Basic Example

<script lang="ts">
	import { Pin, PinInput } from 'lithesome';

	let value = $state([]);
</script>

<Pin bind:value>
	<PinInput />
	<PinInput />
	<PinInput />
	<PinInput />
</Pin>

API Reference

<Pin />

PropertyTypeDescription
value string[]

The current value of the pin inputs.

disabled boolean

Disables the entire component tree.

type 'text' | 'password'

The type of input used for each `<PinInput />`

placeholder string

The placeholder string for each `<PinInput />` if not hovered and no value.

onChanged (value: string[]) => void

Fires when the `value` prop is changed.

onFilled (value: string[]) => void

Fires when all inputs have been filled in.

ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
filledbooleanTrue if all inputs have a value.

<PinInput />

PropertyTypeDescription
ref E

The reference to the underlying element.

StateTypeDescription
filledbooleanTrue if all inputs have a value.
disabledbooleanTrue if the root component is true.
focusedbooleanTrue if this specific input is being focused.