base-ui-svelte

Input

A text input control.

View as Markdown

Sizes

Interactive

Value: Hello

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Input

A native input element that automatically works with [Field](https://base-ui.com/react/components/field). Renders an <input> element.

Props

disabled boolean false
Description

Whether the control ignores user interaction.

Type
boolean
Default
false
value string —
Name
value
Description

Controlled value.

Type
string | undefined
defaultValue string —
Description

Uncontrolled initial value.

Type
string
onValueChange function —
Description

Event handler called when the value changes.

Type
((value: string, event: Event) => void) | undefined
children snippet —
Description

Content rendered inside the part.

Type
Snippet

Data attributes

AttributeDescription
data-dirtyPresent when the input's value has changed (when wrapped in Field.Root).
data-disabledPresent when the input is disabled.
data-filledPresent when the input is filled (when wrapped in Field.Root).
data-focusedPresent when the input is focused (when wrapped in Field.Root).
data-invalidPresent when the input is in an invalid state (when wrapped in Field.Root).
data-touchedPresent when the input has been touched (when wrapped in Field.Root).
data-validPresent when the input is in a valid state (when wrapped in Field.Root).