Skip to main content

Textarea

A field for free text over several lines.

In Brand expressive

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Brand expressive: A free-text answer longer than one line. Not in place of the sign-up email.

  • Use it when: Comments, descriptions, anything longer than one line.
  • Not when: A one-line value (input), or a known set of options.

Instead:

How Brand expressive uses it​

Field label or column header
Use type.label
Not type.caption
Labels stay readable on vivid color.

Words​

  • Headlines are short and bold. Three to six words.
  • Verbs that move: Join, Try, Go.
  • Playful in headlines, plain in errors.
  • Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.

The labels components use, from the voice tokens:

  • content.action.commit: Go
  • content.action.cancel: Not now
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Explore the drop

See Voice and tone for the whole voice.

Accessibility and keyboard​

Test before you ship:

  • It has a visible label; a limit is announced as people type. undefined

Use it in code​

npx open-ds add textarea

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Textarea reads 14 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Textarea's tokens to change Textarea alone.

Changes with theme

Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Textarea
Cornercomponent.textarea.radiusradius.controlvar(--textarea-radius)radius.999:9999px
Border
Changes with theme
component.textarea.bordercolor.border.strongvar(--textarea-border)Lighttaupe.light.500:#8A6F63Darktaupe.dark.400:#B5988A
Padding, left and rightcomponent.textarea.padding-xspace.inset.control-xvar(--textarea-padding-x)space.28:1.75rem
Padding, top and bottomcomponent.textarea.padding-ycomponent-spacing-map.x2var(--textarea-padding-y)space.8:0.5rem
Text sizecomponent.textarea.font-sizetype.body.font-sizevar(--textarea-font-size)font.size.17:1.0625rem
Shadow
Changes with theme
component.textarea.shadowelevation.cardvar(--textarea-shadow)Lightshadow.cardDarkshadow.card-dark
Label placeholder
Changes with theme
component.textarea.label-placeholdercolor.text.mutedvar(--textarea-label-placeholder)Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A
Border focus
Changes with theme
on focus
component.textarea.border-focuscolor.border.focusvar(--textarea-border-focus)Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA
Disabled opacity disabled
when disabled
component.textarea.disabled-opacity-disabledopacity.disabledvar(--textarea-disabled-opacity-disabled)opacity.40:0.4
Border invalid
Changes with theme
when invalid
component.textarea.border-invalidcolor.status.dangervar(--textarea-border-invalid)Lightred.light.600:#C42B2BDarkred.dark.600:#F28B8B
Focus ring invalid
Changes with theme
when invalid
component.textarea.focus-ring-invalidcolor.status.dangervar(--textarea-focus-ring-invalid)Lightred.light.600:#C42B2BDarkred.dark.600:#F28B8B
Focus
on focus
component.textarea.focusborder-width.focusvar(--textarea-focus)border-width.3:3px
Focus ring focus
Changes with theme
on focus
component.textarea.focus-ring-focuscolor.border.focusvar(--textarea-focus-ring-focus)Lightpink.light.600:#D61F7ADarkpink.dark.600:#F59ACA
Focus ring offset focus
Changes with theme
on focus
component.textarea.focus-ring-offset-focuscolor.surface.canvasvar(--textarea-focus-ring-offset-focus)Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Lighttaupe.light.200 · #F2DCCFDarktaupe.dark.100 · #33241F