Forms
Textarea
Multi-line text with the same label, description and error wiring as Input, plus autosize and a character counter.
import { Textarea } from '@reactloom/ui';Examples
Basic
Visible to your team only.
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.
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
| Prop | Type | Default |
|---|---|---|
labelVisible label, associated with the control. | ReactNode | — |
descriptionHelp text linked with aria-describedby. | ReactNode | — |
errorError message; marks the control invalid and is described. | ReactNode | — |
invalidInvalid without a message. | boolean | false |
hideLabelKeep the label for screen readers, hide it visually. | boolean | false |
showOptionalAppend “(optional)” to labels of non-required fields. | boolean | false |
autosizeGrow with content. | boolean | false |
minRows / maxRows | number | 3 / 12 |
showCountCharacter counter (uses maxLength). | boolean | false |
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
| Variable | Default |
|---|---|
--pl-input-radius | var(--pl-radius-md |
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[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.
| Key | Action |
|---|---|
| Tab | Move into / out of the field |
| Enter | New line (it never submits the form) |
| Ctrl / ⌘ + Enter | Nothing 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.