Preview
Plain text; the field auto-grows up to maxHeight.
Installation
Install the runtime packages:
pnpm add @oshon-ai/components @oshon-ai/tokens @oshon-ai/primitives
Or scaffold the component source directly into your codebase (shadcn-style):
pnpm dlx @oshon-ai/cli add textarea
Wire the tokens into your Tailwind v4 stylesheet:
/* app/globals.css */ @import 'tailwindcss'; @import '@oshon-ai/tokens/css'; @import '@oshon-ai/tokens/tailwind';
New here? Walk through the full setup — prereqs, theming, your first render.
Usage
Import the component and render it. Every component supports the standard tier, size, and disabled props where applicable.
'use client';
import { TextArea } from '@oshon-ai/components';
export default function Example() {
return <TextArea />;
}Basic — controlled
Keep it short.
0/200
<BasicField />
State matrix — Desktop (m)
Enabled
Optional Description
0/200
Filled
Optional Description
41/200
ErrorEmpty
Mandatory Error Description
0/200
ErrorFilled
Mandatory Error Description
17/200
DisabledEmpty
Optional Description
0/200
DisabledFilled
Optional Description
17/200
<div style={stackCol}>
<p style={sectionHeading}>Enabled</p>
<TextArea label="Label" required tooltip description="Optional Description" maxLength={200} />
<p style={sectionHeading}>Filled</p>
<TextArea label="Label" required tooltip description="Optional Description" defaultValue="User entered text spanning several words." maxLength={200} />
<p style={sectionHeading}>ErrorEmpty</p>
<TextArea label="Label" required tooltip error="Mandatory Error Description" maxLength={200} />
<p style={sectionHeading}>ErrorFilled</p>
<TextArea label="Label" required tooltip defaultValue="User entered text" error="Mandatory Error Description" maxLength={200} />
<p style={sectionHeading}>DisabledEmpty</p>
<TextArea label="Label" required tooltip description="Optional Description" disabled maxLength={200} />
<p style={sectionHeading}>DisabledFilled</p>
<TextArea label="Label" required tooltip description="Optional Description" defaultValue="User entered text" disabled maxLength={200} />
</div>State matrix — Mobile
Enabled
Optional Description
0/200
Filled
Optional Description
17/200
ErrorFilled
Mandatory Error Description
17/200
<div style={stackCol}>
<p style={sectionHeading}>Enabled</p>
<TextArea size="mobile" label="Label" required tooltip description="Optional Description" maxLength={200} />
<p style={sectionHeading}>Filled</p>
<TextArea size="mobile" label="Label" required tooltip description="Optional Description" defaultValue="User entered text" maxLength={200} />
<p style={sectionHeading}>ErrorFilled</p>
<TextArea size="mobile" label="Label" required tooltip defaultValue="User entered text" error="Mandatory Error Description" maxLength={200} />
</div>Size ladder — xs → mobile
Proportional to Figma scale.
2/200
Proportional to Figma scale.
6/200
Proportional to Figma Desktop.
22/200
Proportional to Figma scale.
5/200
Proportional to Figma Mobile.
21/200
<SizeLadderPlayground />
Styling
Three layers of customization, in order of escape-hatch strength: className overrides → data-attribute targeting → CSS custom properties.
Passing Tailwind classes
Every Oshon component accepts a className prop merged AFTER the component's default classes. Use it to override spacing, color, or size without forking the component.
<TextArea className="ring-2 ring-offset-2 ring-blue-500" />
Data attributes
Oshon components expose their internal state as data-oshon-* attributes so you can target them from CSS without coupling to internal class names. The most common attributes are listed below — see the component's source for the full set.
| Attribute | Values | Description |
|---|---|---|
data-oshon-size | xs · s · m · l · mobile | Visual size axis. Mirrors the `size` prop. |
data-oshon-tier | primary · secondary · tertiary | Visual emphasis tier (Button family). Mirrors the `tier` prop. |
data-oshon-state | enabled · active · error · disabled | Component surface state. Set automatically based on props. |
data-disabled | true · (omitted) | Set when `disabled` is true. Pair with `:disabled` CSS for native input components. |
data-state | open · closed · checked · unchecked · … | Radix-derived state for overlay components (Dialog, Tabs, Toggle, etc.). |
/* Target the secondary tier specifically */
[data-oshon-tier="secondary"] {
--oshon-color-primary-700: var(--my-brand-color);
}Interactive states
Every interactive component supports the standard CSS pseudo- classes plus Tailwind's state variants. Focus rings always use :focus-visible so keyboard users see them but mouse users don't.
:hover/hover:*— pointer hover:focus-visible/focus-visible:*— keyboard focus:active/active:*— pressed:disabled/disabled:*— set via thedisabledprop
Anatomy
The named regions a consumer composes when rendering this component. Each is documented separately so you can target keyboard nav, ARIA labels, and slot props with precision.
labelField label (ReactNode). Desktop: Lato Medium 12/16 neutral-600. Mobile: Lato Regular 14/18 neutral-600.
tooltipOptional info-icon slot next to the required asterisk.
secondaryActionRight-justified slot inside the label row.
descriptionHelper message under the field. Suppressed when `error` is present.
errorError message under the field. When truthy, sets aria-invalid=true and overrides description.
Keyboard
Tab/Shift+Tab: focus. All native <textarea> behavior (Enter for newline, Shift+Enter for submit if wired). Label associated via htmlFor/id. Description + error + counter wired via aria-describedby. `required` sets aria-required; `error` sets aria-invalid.
Accessibility
Every Oshon component ships axe-clean. We test in CI on every PR and publish the audit log per component.
- WCAG level
- 2.2 AA
- Screen readers tested
- VoiceOver (macOS), NVDA (Windows)
- Last axe audit
- 2026-04-21
Do / Don't
✓ Do
<TextArea label="Notes" placeholder="Add a note…" />
<TextArea label="Bio" maxLength={200} description="Keep it short." /><TextArea label="Summary" required error="Required." />
<TextArea size="mobile" label="Message" maxLength={200} />✗ Don't
<textarea />
Loses the Figma-literal state machine, aria-describedby wiring, the counter display, the permission + audit plumbing, and the proprietary focus ring.
<TextArea label="X" required aria-required />
TextArea drives aria-required from `required` and aria-invalid from `error`. Manual wiring fights the state machine.
<TextArea label="X" description="Help" error="Bad" />
Figma contract: description xor error. When `error` is present, description is suppressed.
Design rationale
Phase 4e.3 visual fidelity refit. Pixel-literal port of Figma DS 3.1 TextArea component set (node 5984:15699) — all 16 variants. Min-height per size roughly matches the Figma 3-line depth (72px at m desktop, 96px at mobile). Counter is the only divergence from TextField: right-justified with typography-color split per Figma (current in neutral-900, "/max" in neutral-600). Native `resize-y` is allowed on enabled states and disabled on disabled.