TextArea
A headless native multiline text input with modality-aware focus state, RAC-style disabled and read-only booleans, validation data attributes, and optional auto-resize behavior.
Anatomy
TextArea is a single-part component that renders a native <textarea>. All native textarea attributes pass straight through.
<script>
import { TextArea } from '@human-kit/ui';
</script>
<TextArea aria-label="Message" placeholder="Write your message..." required autoResize />States
Interaction and validation state is exposed through data-* attributes — data-focused, data-focus-visible, data-hovered, data-disabled, data-readonly, data-invalid, data-required, and data-autoresize — so all styling is done with plain CSS or utility classes.
Auto-resize
Enable autoResize when the textarea should grow with content, and bound the height with minRows and maxRows. Leave it off to keep native rows and manual resize behavior.
Usage guidelines
- Use native textarea props like
name,value,placeholder,rows,cols,maxlength, andwrapdirectly onTextArea. - Use
disabled,readonly,invalid, andrequiredto control validation and interaction state while keeping native behavior. - Enable
autoResizewhen the textarea should grow with content. UseminRowsandmaxRowsto bound the height. - Style state with
data-focused,data-focus-visible,data-hovered,data-disabled,data-readonly,data-invalid,data-required, anddata-autoresize.
Accessibility
TextArearenders a native<textarea>and supportsbind:value.data-focus-visiblefollows the shared modality contract and only appears for keyboard or virtual focus.invalidmaps toaria-invalid,readonlymaps toreadonlyandaria-readonly, andrequiredmaps torequiredandaria-required.- Native textarea semantics already expose multiline textbox behavior, so no manual
aria-multilineis needed.
API reference
Root
The textarea control. Renders a native <textarea> and forwards all native attributes while exposing state through data attributes.
* required. Native HTML attributes of the underlying element are also accepted.