Number Input

Previous Next

An input that returns a number value and automatically handles invalid inputs.

Installation

pnpm dlx shadcn-svelte@latest add https://wds-shadcn-registry-svelte.netlify.app/registry/number-input.json

Usage

<script lang="ts">
	import { NumberInput, NumberInputGroup } from '$lib/components/number-input';
	import * as InputGroup from '$lib/components/ui/input-group/index.js';
 
	let value = $state<number | null>(null);
</script>
 
<NumberInput bind:value />
// Or
<InputGroup.Root>
	<NumberInputGroup bind:value />
</InputGroup.Root>

Examples

With Input Group

Form