Forms Core Stable

Textarea

A multi-line text field with an optional live character counter and auto-growing height, built on a native textarea

Preview

Installation

pnpm add fancy-ui-svelte
import { Textarea } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { Textarea } from 'fancy-ui-svelte';
</script>

<Textarea />

Examples

Basic Usage

A single multi-line message field with a bound value.

With Counter

maxlength plus the live "n / max" counter.

Auto Resize

Grows with content instead of scrolling.

Props

PropTypeDefaultDescription
value string""Current value; bindable
onValueChange (value: string) => void-Called with the new value on every input event
placeholder string-Shown while the field is empty
disabled booleanfalseBlocks focus and typing; excluded from form submission
readonly booleanfalseBlocks typing but stays focusable and is still submitted, unlike disabled
required booleanfalseNative required
invalid booleanfalseDrives the error border and aria-invalid
id string-Element id
name string-Native name, read on form submission
autocomplete FullAutoFill-Native autocomplete hint; the union from svelte/elements, not an arbitrary string
label string-Accessible name — for a control with no visible Label next to it
rows number3Visible height in text rows before anything grows it; also the no-JS height
maxlength number-Native character ceiling; also the counter's denominator
showCount booleanfalseRenders the live "n / max" counter under the field
autoResize booleanfalseGrows to fit content instead of scrolling; disables manual resize
class string-Additional CSS classes — applied to the textarea itself, not the wrapper
ref HTMLTextAreaElement | nullnullBindable element reference