Textarea

A multi-line text input component for longer text entries

Variants


Code Svelte
1
2<script lang="ts">
3  import { Textarea, Label } from "@kareyes/aether";
4
5  let defaultValue = $state("");
6  let outlineValue = $state("");
7  let filledValue = $state("");
8  let ghostValue = $state("");
9  let underlineValue = $state("");
10</script>
11
12<div class="grid gap-6 md:grid-cols-2">
13  <div class="space-y-2">
14    <Label class="text-sm font-medium">Default</Label>
15    <Textarea bind:value={defaultValue} placeholder="Default variant..." />
16  </div>
17
18  <div class="space-y-2">
19    <Label class="text-sm font-medium">Outline</Label>
20    <Textarea variant="outline" bind:value={outlineValue} placeholder="Outline variant..." />
21  </div>
22
23  <div class="space-y-2">
24    <Label class="text-sm font-medium">Filled</Label>
25    <Textarea variant="filled" bind:value={filledValue} placeholder="Filled variant..." />
26  </div>
27
28  <div class="space-y-2">
29    <Label class="text-sm font-medium">Ghost</Label>
30    <Textarea variant="ghost" bind:value={ghostValue} placeholder="Ghost variant..." />
31  </div>
32
33  <div class="space-y-2">
34    <Label class="text-sm font-medium">Underline</Label>
35    <Textarea variant="underline" bind:value={underlineValue} placeholder="Underline variant..." />
36  </div>
37</div>

Sizes


Code Svelte
1
2<script lang="ts">
3  import { Textarea, Label } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6">
7  <div class="space-y-2">
8    <Label class="text-sm font-medium">Small</Label>
9    <Textarea size="sm" placeholder="Small size textarea..." />
10  </div>
11
12  <div class="space-y-2">
13    <Label class="text-sm font-medium">Default</Label>
14    <Textarea size="default" placeholder="Default size textarea..." />
15  </div>
16
17  <div class="space-y-2">
18    <Label class="text-sm font-medium">Large</Label>
19    <Textarea size="lg" placeholder="Large size textarea..." />
20  </div>
21</div>

Features

Grows from 3 to 8 rows automatically

0/200

Shows character count in corner

This field is required

0/100

Message is too long


Code Svelte
1
2<script lang="ts">
3  import { Textarea, Label } from "@kareyes/aether";
4
5  let autoResizeValue = $state("");
6  let withCountValue = $state("");
7</script>
8
9<div class="grid gap-6 md:grid-cols-2">
10  <div class="space-y-2">
11    <Label class="text-sm font-medium">Auto-Resize (3-8 rows)</Label>
12    <Textarea
13      bind:value={autoResizeValue}
14      autoResize
15      minRows={3}
16      maxRows={8}
17      placeholder="Type multiple lines to see auto-resize..."
18    />
19  </div>
20
21  <div class="space-y-2">
22    <Label class="text-sm font-medium">Character Counter (max 200)</Label>
23    <Textarea
24      bind:value={withCountValue}
25      maxLength={200}
26      showCount
27      placeholder="Type to see counter..."
28    />
29  </div>
30
31  <div class="space-y-2">
32    <Label class="text-sm font-medium">Disabled</Label>
33    <Textarea disabled value="This textarea is disabled" />
34  </div>
35
36  <div class="space-y-2">
37    <Label class="text-sm font-medium">Error State</Label>
38    <Textarea error={true} placeholder="This field has an error..." />
39    <p class="text-xs text-destructive">This field is required</p>
40  </div>
41
42  <div class="space-y-2">
43    <Label class="text-sm font-medium">Resize: None</Label>
44    <Textarea resize="none" placeholder="Cannot be manually resized..." />
45  </div>
46
47  <div class="space-y-2">
48    <Label class="text-sm font-medium">Resize: Both</Label>
49    <Textarea resize="both" placeholder="Resize in any direction..." />
50  </div>
51</div>

Form Example

0/500

Your message will be sent to our support team.


Code Svelte
1
2<script lang="ts">
3  import { Textarea, Button, Label } from "@kareyes/aether";
4
5  let formData = $state({
6    name: "",
7    email: "",
8    message: "",
9  });
10
11  function handleSubmit() {
12    console.log("Form submitted:", formData);
13    alert(\`Message submitted:\n\n\${formData.message}\`);
14  }
15</script>
16
17<form class="space-y-4" on:submit|preventDefault={handleSubmit}>
18  <div class="space-y-2">
19    <Label for="name">Name <span class="text-destructive">*</span></Label>
20    <input
21      id="name"
22      type="text"
23      bind:value={formData.name}
24      placeholder="John Doe"
25      required
26    />
27  </div>
28
29  <div class="space-y-2">
30    <Label for="message">Message <span class="text-destructive">*</span></Label>
31    <Textarea
32      id="message"
33      bind:value={formData.message}
34      variant="outline"
35      size="lg"
36      maxLength={500}
37      showCount
38      autoResize
39      minRows={4}
40      maxRows={10}
41      placeholder="Type your message here..."
42      required
43    />
44  </div>
45
46  <Button type="submit">Submit Message</Button>
47</form>

Combined Features

0/100
0

Code Svelte
1
2<script lang="ts">
3  import { Textarea, Label } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6 md:grid-cols-2">
7  <div class="space-y-2">
8    <Label class="text-sm font-medium">Small + Filled + Counter</Label>
9    <Textarea
10      variant="filled"
11      size="sm"
12      maxLength={100}
13      showCount
14      placeholder="Compact with counter..."
15    />
16  </div>
17
18  <div class="space-y-2">
19    <Label class="text-sm font-medium">Large + Auto-Resize + Counter</Label>
20    <Textarea
21      variant="outline"
22      size="lg"
23      autoResize
24      minRows={3}
25      maxRows={6}
26      showCount
27      placeholder="Full-featured textarea..."
28    />
29  </div>
30</div>

Textarea Variants & Features

Different styles and features for textarea fields

0/100

Maximum 200 characters

0/200

Automatically grows with content


Code Svelte
1
2<script lang="ts">
3  import { Textarea, Card, Field } from "@kareyes/aether";
4
5  let description = $state("");
6</script>
7
8<div class="grid gap-6 md:grid-cols-2">
9  <Card>
10    <Field label="Error State inside Field Textarea" error="This field has an error">
11      <Textarea
12        error={true}
13        maxLength={100}
14        showCount
15        placeholder="Message exceeds limit..."
16      />
17    </Field>
18  </Card>
19
20  <Card>
21    <Field label="Outline Textarea">
22      <Textarea placeholder="Enter your text..." variant="outline" />
23    </Field>
24  </Card>
25
26  <Card>
27    <Field label="With Character Counter" description="Maximum 200 characters">
28      <Textarea
29        bind:value={description}
30        placeholder="Enter your text..."
31        maxLength={200}
32        showCount
33      />
34    </Field>
35  </Card>
36
37  <Card>
38    <Field label="Auto-Resize" description="Automatically grows with content">
39      <Textarea placeholder="Start typing..." autoResize minRows={2} maxRows={6} />
40    </Field>
41  </Card>
42</div>