Welcome to Oshon · v1.0  ·  Now in public beta for enterprise teams Read the launch notes
Text InputsUpdatedFreeWCAG 2.2 AA

Text Area

Multi-line input — labels, descriptions, auto-grow.

Preview

Live preview
@oshon-ai/components

Plain text; the field auto-grows up to maxHeight.

Installation

Install the runtime packages:

pnpm
pnpm add @oshon-ai/components @oshon-ai/tokens @oshon-ai/primitives

Or scaffold the component source directly into your codebase (shadcn-style):

pnpm
pnpm dlx @oshon-ai/cli add textarea

Wire the tokens into your Tailwind v4 stylesheet:

css
/* 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.

tsx
'use client';
import { TextArea } from '@oshon-ai/components';

export default function Example() {
  return <TextArea />;
}

Basic — controlled

Keep it short.

0/200

Length: 0
tsx
<BasicField />

State matrix — Desktop (m)

Enabled

Optional Description

0/200

Filled

Optional Description

41/200

ErrorEmpty

0/200

ErrorFilled

17/200

DisabledEmpty

Optional Description

0/200

DisabledFilled

Optional Description

17/200

tsx
<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

17/200

tsx
<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

tsx
<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.

tsx
<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.

AttributeValuesDescription
data-oshon-sizexs · s · m · l · mobileVisual size axis. Mirrors the `size` prop.
data-oshon-tierprimary · secondary · tertiaryVisual emphasis tier (Button family). Mirrors the `tier` prop.
data-oshon-stateenabled · active · error · disabledComponent surface state. Set automatically based on props.
data-disabledtrue · (omitted)Set when `disabled` is true. Pair with `:disabled` CSS for native input components.
data-stateopen · closed · checked · unchecked · …Radix-derived state for overlay components (Dialog, Tabs, Toggle, etc.).
css
/* 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 the disabled prop

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.

label

Field label (ReactNode). Desktop: Lato Medium 12/16 neutral-600. Mobile: Lato Regular 14/18 neutral-600.

tooltip

Optional info-icon slot next to the required asterisk.

secondaryAction

Right-justified slot inside the label row.

description

Helper message under the field. Suppressed when `error` is present.

error

Error 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

Basic
<TextArea label="Notes" placeholder="Add a note…" />
With counter
<TextArea label="Bio" maxLength={200} description="Keep it short." />
Required + error
<TextArea label="Summary" required error="Required." />
Mobile size
<TextArea size="mobile" label="Message" maxLength={200} />

✗ Don't

Using <textarea> directly and skipping TextArea
<textarea />

Loses the Figma-literal state machine, aria-describedby wiring, the counter display, the permission + audit plumbing, and the proprietary focus ring.

Forwarding native `required` + aria-required
<TextArea label="X" required aria-required />

TextArea drives aria-required from `required` and aria-invalid from `error`. Manual wiring fights the state machine.

Rendering both description AND error
<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.