Forms

Textarea

Multi-line text input. Auto-resizes if you let it, or clamp via rows.

Preview
01 Installation

Install

Pull Textarea from the barrel for everyday use, or the granular path when you want a tighter bundle.

tsxBarrel1 line
import { Textarea } from "@brika/clay";
tsxGranular1 line
import { Textarea } from "@brika/clay/components/textarea";
02 Usage

A minimal example

Drop this into a page. Native HTML attributes pass through to the underlying primitive.

tsxTextarea.tsx12 lines
'use client';

import { Textarea } from '@brika/clay/components/textarea';

/** Multi-line text input in its default auto-sizing state. */
export default function TextareaDefaultDemo() {
  return (
    <div className="w-full max-w-sm">
      <Textarea placeholder="Tell us about your project…" />
    </div>
  );
}
03 Examples

Textarea, every way

Controlled

Controlled textarea showing a live character counter.

Disabled

Disabled textarea blocks interaction and reduces opacity.

Invalid

Validation error state, aria-invalid triggers the destructive border.

Rows

Fixed height using the rows attribute.

04 Accessibility

Accessibility

  • Always associate with a <Label> via matching id / htmlFor.
  • aria-invalid="true" triggers the destructive ring; pair with a visible error message via aria-describedby.
  • Disabled textareas are removed from the tab order, use readOnly when content must stay focusable.
  • Character count readouts should be linked via aria-describedby so AT announces remaining characters.
05 Tokens 20 theme-overridable

Theme tokens

Every CSS variable Textarea reads, with its default and the dotted path you'd write in a ThemeConfig JSON to override it. Set any of these in your theme to retune Textarea without touching component code.

Textarea tokens

20 tokens
ColorFill, border, and text colors.5
  • --textarea-containercolorvar(--input-container)
    components.textarea.container

    Background color of the textarea. Inherits the standalone Input container so themes that retune `--input-container` retune the textarea automatically.

  • --textarea-labelcolorvar(--input-label)
    components.textarea.label

    Foreground color of the text typed into the textarea. Mirrors `--input-label`.

  • --textarea-bordercolorvar(--input-border)
    components.textarea.border

    Resting border color of the textarea. Mirrors `--input-border`.

  • --textarea-placeholdercolorvar(--input-placeholder)
    components.textarea.placeholder

    Foreground color of the textarea placeholder. Mirrors `--input-placeholder`.

  • --textarea-invalid-bordercolorvar(--destructive)
    components.textarea.invalidBorder

    Border color drawn when the textarea is in an invalid state (`aria-invalid=true`).

GeometrySizes, lengths, and corner radii.4
  • --textarea-radiusradiusvar(--radius-control)
    components.textarea.radius

    Textarea corner radius.

  • --textarea-padding-xsizecalc(var(--spacing) * 3)
    components.textarea.paddingX

    Inline padding inside the textarea.

  • --textarea-padding-ysizecalc(var(--spacing) * 2)
    components.textarea.paddingY

    Block padding inside the textarea.

  • --textarea-gapsizecalc(var(--spacing) * 2)
    components.textarea.gap

    Gap between adjacent children inside the textarea.

BorderBorder width and style.2
  • --textarea-border-widthborder-width1px
    components.textarea.borderWidth

    Border width on the textarea. Set non-zero for outline-style variants.

  • --textarea-border-styleborder-stylesolid
    components.textarea.borderStyle

    Border style on the textarea (`solid`, `dashed`, `double`, `none`).

TypographyTypeface, size, weight, spacing.6
  • --textarea-font-familyfont-familyvar(--font-sans)
    components.textarea.fontFamily

    Typeface for textarea.

  • --textarea-font-sizefont-sizevar(--text-body-md)
    components.textarea.fontSize

    Font size for textarea.

  • --textarea-font-weightfont-weight500
    components.textarea.fontWeight

    Font weight for textarea.

  • --textarea-line-heightline-height1.25
    components.textarea.lineHeight

    Line height for textarea.

  • --textarea-letter-spacingletter-spacing0
    components.textarea.letterSpacing

    Letter spacing for textarea. Useful for caps labels.

  • --textarea-text-transformtext-transformnone
    components.textarea.textTransform

    Text transform for textarea (`uppercase`, `lowercase`, `capitalize`, `none`).

ElevationDrop shadow and depth.1
  • --textarea-backdrop-blurblur0px
    components.textarea.backdropBlur

    Backdrop blur applied to the textarea surface. Set non-zero for a frosted-glass treatment.

MotionAnimation duration and easing.2
  • --textarea-durationdurationvar(--motion-standard-duration)
    components.textarea.duration

    Transition duration for textarea state changes.

  • --textarea-easingeasingvar(--motion-standard-easing)
    components.textarea.easing

    Transition easing for textarea state changes.

Override in a theme

Authoring a theme is plain JSON. Drop overrides under components.textarea, the names are camelCase versions of the variable suffix.

jsonmy-theme.json12 lines
{
  "id": "my-theme",
  "name": "My Theme",
  "description": "...",
  "accentSwatches": ["#000"],

  "components": {
    "textarea": {
      "paddingX": "calc(var(--spacing) * 3)"
    }
  }
}

Then apply with applyTheme(myTheme) (see the theming guide), scope it to a subtree with themeToCssVars(myTheme, mode), or consume any token directly in your own JSX with the matching Tailwind utility (e.g. bg-textarea-…) — see the chips on each token row.

06 API reference

API reference

Props specific to Textarea. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.

No wrapper-specific props, all attributes pass through to the underlying primitive.