Skip to content

Textarea

The bq-textarea component is a multi-line text input with label, error, hint, and native form participation.

Basic Usage

html
<bq-textarea label="Message" placeholder="Type your message here"></bq-textarea>

With Value

html
<bq-textarea label="Bio" value="Hello, I'm a developer."></bq-textarea>

Rows

html
<bq-textarea label="Description" rows="6"></bq-textarea>

Required

html
<bq-textarea label="Feedback" required></bq-textarea>

Error State

html
<bq-textarea label="Comment" error="This field is required."></bq-textarea>

Hint Text

html
<bq-textarea label="Notes" hint="Max 500 characters." maxlength="500"></bq-textarea>

Character Counter

Use show-counter together with maxlength to display a live character count below the textarea.

html
<bq-textarea
  label="Bio"
  maxlength="200"
  show-counter
  placeholder="Tell us about yourself"
></bq-textarea>

The counter:

  • Displays in the format "{count} of {max} characters"
  • Turns red when the character limit is exceeded
  • Includes aria-live="polite" for screen reader announcements
  • Is linked to the textarea via aria-describedby

Disabled & Readonly

html
<bq-textarea label="Locked" value="Cannot edit" disabled></bq-textarea>
<bq-textarea label="View only" value="Read-only content" readonly></bq-textarea>

Properties

PropertyTypeDefaultDescription
labelstringVisible label text
valuestringCurrent value
placeholderstringPlaceholder text
namestringForm field name
rowsnumber4Visible row count
disabledbooleanfalseDisables the textarea
readonlybooleanfalseMakes the textarea read-only
requiredbooleanfalseMarks as required
errorstringError message
hintstringHint text
maxlengthstringMaximum character count
show-counterbooleanfalseShow character counter (requires maxlength)

Events

EventDetailDescription
bq-input{ value: string }Fired on each keystroke
bq-change{ value: string }Fired on commit/blur
bq-focusFired on focus
bq-blurFired on blur

CSS Parts

PartDescription
fieldThe field wrapper
labelLabel text element
textareaThe native textarea
footerThe footer area below the textarea
errorError message element
hintHint text element
counterCharacter counter element

Accessibility

  • Links label to textarea via for/id
  • Sets aria-invalid when error is present
  • Links error/hint/counter to textarea via aria-describedby
  • Character counter uses aria-live="polite" for updates

Form Participation

The component creates a hidden input proxy for native <form> submission carrying the name and current value.

Released under the MIT License.