Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Input Group examples · Textarea

Character Counter Input Group (Textarea) for React

A message textarea with its 500-character limit shown in a footer row.

Framework
UI library

A long-form field with its limit under it: a bordered block-end row shows 0/500 at its end, and maxLength on the textarea enforces it.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How is the footer row built?

An InputGroupAddon with align="block-end" and border-t, after the textarea. ms-auto on the count pushes it to the end.

What stops typing at 500?

maxLength={500} on InputGroupTextarea.

Does 0/500 count characters?

No, it's fixed text. Keep the value in state and render its length.

How tall is the textarea?

At least 120 pixels from min-h-[120px], growing with its content.

Is the count announced?

Only if you tie it in with aria-describedby on the textarea.

How is the textarea labeled?

aria-label="Message".