ComponentsMarkdown
Textarea
Multi-line text control with size-matched minimum heights (xs to lg) and vertical resizing (resize-y). Keeps a 16px (--text-body) font size at every size and connects to Field automatically.
Live example
Characters: 36
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "xs" | "sm" | "md" | "lg" | "md" | Minimum height and corner radius tier. |
| rows | number | browser default | Initial visible text lines before vertical resizing. |
| aria-invalid | boolean | "true" | "false" | false | Switches the border to --destructive; wired automatically inside Field. |
| readOnly | boolean | false | Applies a step 2 muted surface with a top-right lock icon while remaining focusable. |
| disabled | boolean | false | Disables editing using step 3 background and step 8 text without opacity. |
Sizes and tokens
| Tier / Role | Token | Value |
|---|---|---|
| xs | --control-height-xs / --control-radius-xs | 24px min-height · radius-sm (4px) · 16px text |
| sm | --control-height-sm / --control-radius-sm | 32px min-height · radius-sm (4px) · 16px text |
| md | --control-height-md / --control-radius-md | 40px min-height · radius-md (8px) · 16px text |
| lg | --control-height-lg / --control-radius-lg | 48px min-height · radius-md (8px) · 16px text |
| Resize | resize-y | Vertical resize enabled; horizontal resize locked |
| Read-only | --muted / --foreground / --control-icon-* | Step 2 surface · normal text · top-right Lock icon · focusable |
States
Code
import { Field, Textarea } from "@freshgemui/monoplinth";
export function Example() {
return (
<Field label="Release summary" description="Summarize breaking changes.">
<Textarea rows={4} placeholder="Enter release notes..." />
</Field>
);
}Do and don't
Do: Lock resizing to vertical and pair with Field
Use resize-y so user resizing never breaks horizontal grid columns, and wrap Textarea in Field for accessible labels and error wiring.
Don't: Allow horizontal resize or show errors with border color alone
Do not enable resize-both inside narrow layouts, and always pair aria-invalid with visible error text.
Accessibility
- Inherits
id,aria-describedby,aria-invalid, andaria-requiredfromFieldcontext automatically. - Locks font size at
16px(text-body) across all sizes to prevent mobile zoom on focus. - Renders a
2px--ringoutline with a2pxoffset on:focus-visibleonly. - Uses step 3 background and step 8 text (
no opacity) when disabled.
Rationale
Binding Textarea minimum height and corner radius to --control-height-* and --control-radius-* keeps multi-line fields visually consistent with single-line Input controls while permitting vertical expansion.