Textarea
Installation
npx @mielui/svelte add textareayarn dlx @mielui/svelte add textareabunx @mielui/svelte add textareaUsage
Bind value to read or set the text. label and description are linked to the native textarea, and every other textarea attribute passes through. Set autoresize to grow the field with its content instead of scrolling. Bind element to reach the textarea, for example to focus it.
<script lang="ts">
import { Textarea } from '@mielui/svelte/components/textarea';
let message = $state('');
</script>
<Textarea bind:value={message} label="Message" autoresize />Examples
Basic
With label and description
Disabled
Composer
Content passed as children renders below the text inside the same field border, here a character count and a send button. autoresize grows the field as you type.
API reference
Textarea
Accepts a multi-line value.
placeholderstringText shown while there is no value.
labelstringVisible label linked to the control.
descriptionstringSupporting text under the label, announced with the control.
variant"outline" | "secondary"outlinehas a border.secondaryhas a filled background.Default
'outline'autoresizebooleanGrows with its content instead of scrolling.
Default
falseclass(string & (ClassValue | null))Classes added to the element.
childrenSnippet<[]>Content rendered inside.
elementBindableHTMLTextAreaElementBindable reference to the DOM element.
valueBindable((string | number) & (string | number | string[])) | nullField value. Bindable.
pnpm dlx @mielui/svelte add textarea