Forms Core Stable

SearchInput

A pill-shaped search field with a leading icon, a clear button once there's something to clear, and optional debounced search

Preview

Installation

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

Usage

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

<SearchInput />

Examples

Basic Usage

Debounced

onSearch fires 300ms after typing settles instead of on every keystroke.

With FormField

Props

PropTypeDefaultDescription
value string""Current value; bindable
onValueChange (value: string) => void-Called with the new value on every input event
onSearch (value: string) => void-Fired on Enter, and on debounced settle when debounceMs is set
placeholder string"Search"Shown while the field is empty
debounceMs number0Delay before a settled value fires onSearch on its own; 0 disables debouncing
disabled booleanfalseBlocks focus and typing; excluded from form submission
readonly booleanfalseBlocks typing and clearing but stays focusable and is still submitted
required booleanfalseNative required
invalid booleanfalseDrives the error border and aria-invalid
id string-Element id
name string-Native name, read on form submission
label string-Accessible name — for a control with no visible Label next to it
clearable booleantrueRenders a clear button once there is something to clear
class string-Additional CSS classes, merged onto the field surface
ref HTMLInputElement | nullnullBindable element reference