Forms Core Stable

Input

A single-line text field with resting, focus, error and disabled looks, built on a native input

Preview

Installation

pnpm add fancy-ui-svelte
import { Input } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { Input } from 'fancy-ui-svelte';
</script>

<Input />

Examples

Basic Usage

A single email field with a bound value.

States

Resting, focus, error and disabled, side by side.

Types

Every native input type the component accepts.

With FormField

Wrapped in FormField and Label — no id or invalid prop needed on Input itself.

Props

PropTypeDefaultDescription
value string""Current value; bindable
onValueChange (value: string) => void-Called with the new value on every input event
type "text" | "email" | "url" | "tel" | "password" | "search" | "number""text"Native input type
placeholder string-Shown while the field is empty
disabled booleanfalseBlocks focus and typing; excluded from form submission
readonly booleanfalseBlocks typing but stays focusable and is still submitted, unlike disabled
required booleanfalseNative required
invalid booleanfalseDrives the error border and aria-invalid
id string-Element id
name string-Native name, read on form submission
autocomplete FullAutoFill-Native autocomplete hint; the union from svelte/elements, not an arbitrary string
label string-Accessible name — for a control with no visible Label next to it
class string-Additional CSS classes
ref HTMLInputElement | nullnullBindable element reference