Textarea
A multi-line text field with a label, an optional character counter and an error message.
<arc-textarea>Overview
Textarea wraps a native <textarea> with an uppercase label, a placeholder, an optional character counter and an error message. Use it for anything longer than one line, such as a support request, a comment or a bio.
rows sets the starting height (4 by default). resize sets which way the reader can drag the field: vertical (the default), horizontal, both or none.
Set maxlength and a live counter appears below the field. It turns red when the text reaches the limit, and screen readers hear the count through a polite live region. Pair Textarea with Form for validation, submission and an error summary across the whole form.
Guidelines
Do
- Set a `label`. It's the field's accessible name
- Use `placeholder` for an example value, never in place of the label. It disappears once the reader types
- Set `maxlength` when the backend or the design has a limit, so the reader sees it as they type
- Choose `rows` to match the length you expect
- Use `resize="none"` when the field sits in a fixed-height layout
- Use the `error` prop to show server-side validation messages after submission
Don't
- Don't use Textarea for single-line values such as a name or an email. Use Input
- Don't set `disabled` and `error` together. The reader can't act on the error
- Don't restyle the border and focus ring with custom CSS. Change the design tokens
Features
- The label is linked to the field with `aria-labelledby`
- `error` turns the border red and shows the message below the field with `role="alert"`
- `readonly` allows selecting and copying but not editing, and `disabled` blocks all interaction
- Fires `arc-input` on every keystroke and `arc-change` on blur
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<div style="width:100%;">
<arc-textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
rows="5"
maxlength="500"
></arc-textarea>
</div>import { Textarea } from '@arclux/arc-ui-react';
export default function Example() {
return (
<div style={{ width: '100%' }}>
<Textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
rows={5}
maxlength={500}
/>
</div>
);
}<script setup>
import { Textarea } from '@arclux/arc-ui-vue';
</script>
<template>
<div style="width:100%;">
<Textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
:rows="5"
:maxlength="500"
/>
</div>
</template><script>
import { Textarea } from '@arclux/arc-ui-svelte';
</script>
<div style="width:100%;">
<Textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
rows={5}
maxlength={500}
/>
</div>import { Component } from '@angular/core';
import { Textarea } from '@arclux/arc-ui-angular';
@Component({
imports: [Textarea],
template: `
<div style="width:100%;">
<arc-textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
[rows]="5"
[maxlength]="500"
></arc-textarea>
</div>
`,
})
export class SupportFormComponent {}import { Textarea } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<div style={{ width: '100%' }}>
<Textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
rows={5}
maxlength={500}
/>
</div>
);
}import { Textarea } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<div style={{ width: '100%' }}>
<Textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
rows={5}
maxlength={500}
/>
</div>
);
}<div style="width:100%;">
<arc-textarea
label="Describe your issue"
placeholder="Please provide as much detail as possible..."
rows="5"
maxlength="500"
></arc-textarea>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-textarea — self-contained, no external CSS needed -->
<div class="arc-textarea">
</div>API
valuestring''- The current text content of the textarea. Updated on every keystroke and emitted via
arc-inputandarc-changeevents. namestring''- Form field name submitted with the value. Required for native form integration via ElementInternals.
placeholderstring''- Hint text displayed inside the field when it is empty. Use it to show example input, never as a substitute for the label.
labelstring''- Visible label rendered above the textarea in uppercase. Automatically linked to the field via
aria-labelledby, ensuring screen readers announce it correctly. rowsnumber4- The number of visible text rows that set the initial height of the textarea. Does not limit content length; the user can scroll or resize beyond this height.
disabledbooleanfalse- Prevents user interaction and applies a muted visual treatment at 40% opacity. The field value is excluded from form submission when disabled.
errorstring''- Error message string. When non-empty, the textarea border turns red and the message is displayed below the field with
role="alert"for screen reader announcement. maxlengthnumber0- Maximum number of characters allowed. When set to a value greater than 0, a live counter appears below the field showing current length vs. limit, turning red when the limit is reached.
resize'none' | 'vertical' | 'horizontal' | 'both''vertical'- Controls whether and in which direction the user can drag to resize the textarea. Defaults to vertical-only resizing.
readonlybooleanfalse- Allows the user to select and copy text but prevents editing. The field has a subtle background change to indicate its read-only state.
size'sm' | 'md' | 'lg''md'- Controls the textarea size. Options: 'sm', 'md', 'lg'.
autoResizebooleanfalse- Automatically grows the textarea height to fit its content. Disables manual resize when enabled.
formAssociatedbooleantruepropertiesobject{ // flag(), unlike `disabled`. The exclusion in props.js is specifically // about form-associated *platform* semantics: a `disabled` content // attribute that is merely present makes the element actually disabled // per the HTML spec, and formDisabledCallback assigns the property back, // so no converter can win. Neither of these is platform-mapped: // `required` is enforced by _computeValidity() below and `readonly` by // each component's own interaction handlers, so the stock converter buys // nothing here and costs the usual bug: `required="false"` read as true, // blocking submission of a form the author meant to leave optional. // Finding #48's shape, across all 26 form controls at once. required: flag(false), readonly: flag(false), }- Lit merges static properties up the prototype chain, so every consumer
gets these without declaring them.
requiredparticipates in constraint validation below;readonlyreflects for styling and is enforced by each component's interaction handlers (the mixin can't know which gestures mutate state). autoValidatesbooleantrue- Components that run their own constraint-validation logic (pattern checks, range checks) opt out of the automatic required sync by overriding this to false, and own the whole validity flag set instead.
formvalidityvalidationMessagerequiredbooleanfalse
Methods
checkValidity()boolean- Whether the control currently satisfies its constraints, per the native
constraint-validation API. Fires
invalidon the element when it does not, and reports nothing to the user. reportValidity()boolean- As checkValidity(), but also shows the browser's validation message against the control when it fails.
Events
arc-inputdetail:{ value: string }- Fired on each keystroke with { value } detail
arc-changedetail:{ value: string }- Fired on blur when value has changed