Textarea

Textarea lets you create accessible textareas. The API is pretty much the same as TextInput.


Same Markup as TextInput

Textarea has possibly the simplest markup you’ll ever see. The minimum you need is just name and label.

svelte
<Textarea name="message" label="Message" />

Accessible hint text and error messages

Just use hint and error properties to add them.

svelte
<Textarea
name="message"
label="Message"
hint="Write anything you want!"
/>
<Textarea
name="message"
label="Message"
error="Please keep conversations here friendly and fun."
/>
Hint only
Write anything you want!
Error only
Please keep conversations here friendly and fun.

Auto-growing textarea

Textarea can grow automatically according to its contents. To activate this feature, just set autogrow to true.

<Textarea
name="message"
label="Message"
options={{ autogrow: true }}
/>
Give this a try!

Add items before or after the textarea

Like TextInput, Textarea comes with before and after slots for you to add on elements easily.

svelte
<Textarea name="message" label="Message">
<button slot="after">Send</button>
</Textarea>
Before slot

We get all the tiny details right too. Try it out: Focus on the send button and you’ll see a nice-looking outline that doesn’t include the divider!

Add items before or after the textarea

Like TextInput, Textarea comes with before and after slots for you to add on elements easily.

svelte
<Textarea name="message" label="Message">
<button slot="after">Send</button>
</Textarea>
Before slot

We get all the tiny details right too. Try it out: Focus on the send button and you’ll see a nice-looking outline that doesn’t include the divider!