Text Field

A Material Design 3 text input with a floating label, support text, and error states. Available in filled and outlined variants.

Preview

<script>
  import { TextField } from '@vultra/md3';
</script>

<div class="flex flex-col gap-6">
  <TextField label="Name" placeholder="Enter your name" />
  <TextField label="Email" variant="outlined" type="email" />
  <TextField label="Password" error="Password must be at least 8 characters" />
</div>

Variants

  • filled — Surface container with an active indicator bar (default)
  • outlined — Full border outline with floating label

Usage

<script>
  import { TextField } from '@vultra/md3';

  let name = $state('');
</script>

<TextField
  bind:value={name}
  label="Full name"
  helperText="As it appears on your ID"
  disabled={false}
/>

Props

PropTypeDefaultDescription
valuestring (bindable)''Input value
labelstring''Floating label text
placeholderstring''Placeholder text
variant'filled' \| 'outlined''filled'Text field style
errorstringundefinedError message (shows error state)
disabledbooleanfalseDisables the input
classstringundefinedAdditional CSS classes
idstringundefinedInput id (auto-generated from label otherwise)
typestring'text'Input type
helperTextstringundefinedSupporting text below the field

All other props are forwarded to the underlying <input> element.

Install

npx @vultra/cli add md3-text-field