# Input group: Character count

> `<InputGroupCount />` counts against the field's `maxLength`. Only the digits that change roll. The count darkens near the limit and turns red at it, and a typed key past the limit nudges it. Screen readers hear a message when the field gets close to the limit and when it reaches it, never on every key.

Example: https://hextaui.com/docs/input-group/examples/count
Component docs: https://hextaui.com/docs/input-group.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/input-group-count.json
```

This adds `components/examples/input-group/count.tsx` with the Input group component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/input-group/count.tsx"
import { IconAt } from "@tabler/icons-react"

import {
  InputGroup,
  InputGroupAddon,
  InputGroupCount,
  InputGroupInput,
} from "@/components/ui/input-group"

export function InputGroupCountDemo() {
  return (
    <InputGroup className="max-w-sm">
      <InputGroupInput
        defaultValue="hextaui"
        maxLength={15}
        autoComplete="username"
        aria-label="Username"
      />
      <InputGroupAddon>
        <IconAt />
      </InputGroupAddon>
      <InputGroupAddon align="inline-end">
        <InputGroupCount />
      </InputGroupAddon>
    </InputGroup>
  )
}
```

## Props in this example

### InputGroupAddon

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `"inline-start" \| "inline-end" \| "block-start" \| "block-end"` | `"inline-start"` |  |

## More Input group examples

- [Icon](https://hextaui.com/docs/input-group/examples/icon.md)
- [Clear](https://hextaui.com/docs/input-group/examples/clear.md)
- [Text](https://hextaui.com/docs/input-group/examples/text.md)
- [Button](https://hextaui.com/docs/input-group/examples/button.md)
- [Keyboard hint](https://hextaui.com/docs/input-group/examples/kbd.md)
- [Textarea](https://hextaui.com/docs/input-group/examples/textarea.md)
- [Header](https://hextaui.com/docs/input-group/examples/block-start.md)
- [Password](https://hextaui.com/docs/input-group/examples/password.md)
- [Sizes](https://hextaui.com/docs/input-group/examples/sizes.md)
- [Invalid](https://hextaui.com/docs/input-group/examples/invalid.md)
- [Disabled](https://hextaui.com/docs/input-group/examples/disabled.md)
- [Loading](https://hextaui.com/docs/input-group/examples/loading.md)
- [Dropdown](https://hextaui.com/docs/input-group/examples/dropdown.md)
- [Long content](https://hextaui.com/docs/input-group/examples/long-content.md)
- [Right to left](https://hextaui.com/docs/input-group/examples/rtl.md)
