Character Count

Live React character counter that shows the current count against a limit and turns red when it goes over. Announces changes politely to screen readers.

src/registry/ui/character-count.tsx/r/character-count.json

Installation#

bash
npx shadcn@latest add @minidev/character-count

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/character-count.json

Usage#

tsx
import { CharacterCount } from "@/components/ui/character-count"

export function Example() {
  return (
    <CharacterCount value={12} max={140} />
  )
}

API reference#

CharacterCount props
PropTypeDefault
valuenumber0
max*number-
classNamestring-

* required

Examples#

All form components