Examples

Basic

Preview

Visible to your team only.

Example.tsx
import { Textarea } from '@reactloom/ui';

export default function Example() {
  return (
    <div style={{ width: '100%', maxWidth: 420 }}>
      <Textarea label="Internal notes" description="Visible to your team only." placeholder="Add context for reviewers…" />
    </div>
  );
}

Autosize with counter

The counter is announced politely only near the limit.

Preview
0 / 280
Example.tsx
import { Textarea } from '@reactloom/ui';

export default function Example() {
  return (
    <div style={{ width: '100%', maxWidth: 420 }}>
      <Textarea label="Release summary" showCount maxLength={280} autosize minRows={2} maxRows={8} />
    </div>
  );
}

API reference

Textarea props
PropTypeDefault
label
Visible label, associated with the control.
ReactNode—
description
Help text linked with aria-describedby.
ReactNode—
error
Error message; marks the control invalid and is described.
ReactNode—
invalid
Invalid without a message.
booleanfalse
hideLabel
Keep the label for screen readers, hide it visually.
booleanfalse
showOptional
Append “(optional)” to labels of non-required fields.
booleanfalse
autosize
Grow with content.
booleanfalse
minRows / maxRows
number3 / 12
showCount
Character counter (uses maxLength).
booleanfalse
size
'sm' | 'md' | 'lg''md'

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

Slot class names

Add classes to inner parts with classNames (className is shorthand for root): root, label, description, control, textarea, counter, error.

CSS variables

VariableDefault
--pl-input-radiusvar(--pl-radius-md

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-autosize]present when on
[data-disabled]present when on
[data-invalid]present when on
[data-multiline]present when on
[data-over]present when on
[data-radius]none · sm · md · lg · full
[data-readonly]present when on
[data-size]sm · md · lg

Theme tokens it reads

--pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-focus --pl-color-border-input --pl-color-danger-border --pl-color-danger-fg --pl-color-fg-default --pl-color-fg-disabled --pl-color-fg-muted --pl-color-fg-subtle --pl-control-height-lg --pl-control-height-md --pl-control-height-sm --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-lg --pl-font-size-md --pl-font-size-sm --pl-font-size-xs --pl-radius-full --pl-radius-lg --pl-radius-md --pl-radius-none --pl-radius-sm --pl-shadow-xs

Accessibility

  • The counter is linked with aria-describedby and only becomes a live region in the last 10% of maxLength.
Keyboard interactions
KeyAction
TabMove into / out of the field
EnterNew line (it never submits the form)
Ctrl / ⌘ + EnterNothing by default — add your own submit shortcut if the form needs one

Usage guidelines

Do

  • Set maxLength when the backend has a limit.

Don’t

  • Don’t use a textarea for single-line values.