Hashtag Input

Catches hashtags that quietly break, such as #don't posting as #don, and posts over a platform's tag limit.

StopsHelps catch a hashtag cut short by a space

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/hashtag-input.json

The files land in your project. They're yours to edit.

Usage

hashtag-input-usage.tsx
import { HashtagInput } from "@/components/ui/hashtag-input"

<HashtagInput
  label="Tags for your launch post"
  defaultValue={["opensource", "BuildInPublic", "women's day", "OpenSource", "followforfollow", "WebDev"]}
  banned={["followforfollow", "like4like", "f4f"]}
/>

What it catches

  • Space, apostrophe or punctuation that cuts a tag short
  • All-digit tags that don't link
  • Duplicates that differ only by case
  • Tags on your banned list
  • More tags than a platform allows or recommends (Instagram: 5 per post or Reel)
  • All-lowercase multi-word tags, with a CamelCase suggestion

Props

HashtagInput props
PropTypeDefault
label

Visible label.

string"Hashtags"
value

Controlled tags, without the #.

string[]—
defaultValue

Initial tags when uncontrolled.

string[][]
onValueChange

Called with the current list of tags.

(tags: string[]) => void—
platforms

Per-platform limits shown as counts.

HashtagPlatform[]DEFAULT_PLATFORMS
banned

Tags that are banned or read as spam on your platforms (case-insensitive).

string[]—
words

Extra words (brand names, jargon) used to suggest CamelCase.

string[]—
placeholder

Input placeholder.

string"Add a tag, then Enter"
messages

Messages; `{tag}`, `{at}`, `{posts}`, `{of}` and `{fix}` are filled in.

Partial<Record<HashtagIssue["kind"], string>>—
overLimitText

`{name}`, `{count}` ("1 tag") and `{tags}` are filled in.

string"{name} keeps {max}: {tags} would be dropped."
removeLabel

Accessible label for each tag's remove button; {tag} is filled in.

string"Remove #{tag}"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible label tied to the input; Enter or comma adds a tag, Backspace on an empty field removes the last
  • Each remove button has an aria-label naming the tag
  • Issues are in a polite live region; icons are aria-hidden
  • Animation is skipped under reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • CamelCase split uses a small built-in word list; extend it with the words prop
  • Platform limits are baked in and change; pass your own platforms
  • Does not check whether a tag is shadow-banned or trending

Rules

Rules last verified:

Informational; platform limits change. Only the Instagram limit was checked; LinkedIn and X counts are recommendations and were not re-verified. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Helps catch a hashtag cut short by a space

Also known as

hashtag · tags · social post · instagram · x post · linkedin · camelcase · caption

Field type

Dependencies

Pairs well with