TextField
The TextField component allows users to input and edit text on a single line.
Import
<script>
import { TextField } from 'svelte-fluentui';
</script>
svelte
Basic Usage
<TextField label="Enter your name" />
svelte
With Placeholder
<TextField label="Email" placeholder="user@example.com" />
svelte
Required Field
<TextField label="Username" required />
svelte
Disabled State
<TextField label="Read-only field" value="Cannot edit" disabled />
svelte
Properties
Property | Type | Default | Description |
---|---|---|---|
label | string | undefined | Label text for the field |
value | string | '' | Current value of the input |
placeholder | string | undefined | Placeholder text |
required | boolean | false | Whether the field is required |
disabled | boolean | false | Whether the field is disabled |
type | string | 'text' | Input type (text, email, password, etc.) |
Events
Event | Description |
---|---|
on:input | Fired when the input value changes |
on:focus | Fired when the input gains focus |
on:blur | Fired when the input loses focus |