Textarea

stable 1.6 kB
<hk-textarea>

A textarea that grows with its content up to a ceiling, then scrolls — so a one-line note does not reserve six lines of empty space. Anything projected inside renders in the footer, opposite the counter.

#text#multiline
In the package npm i hellskitchen-ui Import hk-textarea and use it directly.

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
valuestring''Model value. Two-way bindable.
labelstring''Accessible name, applied as the field’s aria-label.
placeholderstring''Native placeholder.
rowsnumber2Starting height in rows.
maxRowsnumber10Height ceiling. Past it the field scrolls instead of growing.
autoGrowbooleantrueResizes to fit the content on every input.
maxlengthnumber | nullnullHard character limit.
counterbooleanfalseShows characters remaining. Needs maxlength.

Outputs

  • valueChangeEventEmitter<string>

    Emits on every keystroke.

Keyboard

  • Enter Inserts a newline — the field never submits the form

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-textarea-min4remFloor height, so an empty field still has a target.
--hk-textarea-max16remCeiling before the field scrolls.

Accessibility

  • Resizing happens after the value lands, so the first paint is already the right height and nothing jumps.
  • The counter is aria-live="polite" and only announces near the limit, not on every keystroke.

More in Forms