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

PropertyTypeDefaultDescription
labelstringundefinedLabel text for the field
valuestring''Current value of the input
placeholderstringundefinedPlaceholder text
requiredbooleanfalseWhether the field is required
disabledbooleanfalseWhether the field is disabled
typestring'text'Input type (text, email, password, etc.)

Events

EventDescription
on:inputFired when the input value changes
on:focusFired when the input gains focus
on:blurFired when the input loses focus