# Follow Button

> A follow button whose plus folds into a check as it turns to Following, and warns with Unfollow on hover before you undo it.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › State Changes |
| Live preview | https://uibrik.com/components/follow-button |
| Writes | 1 file into `components/uibrik/follow-button/` |
| Packages | `@number-flow/react`, `motion`, `react-use-measure` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 22, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/follow-button.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/follow-button`.

Can't run commands? https://uibrik.com/components/follow-button/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { FollowButton } from "@/components/uibrik/follow-button/follow-button";

<FollowButton
  label="Follow"
  followingLabel="Following"
  unfollowLabel="Unfollow"
  count={1284}
  countLabel="followers"
  dangerColor="#dc2626"
  size="md"
  defaultFollowing={false}
  // following={false}
  // onFollowingChange={(following) => {}}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/follow-button.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `label` | `string` | `"Follow"` | Label before following. |
| `followingLabel` | `string` | `"Following"` | Label once followed. |
| `unfollowLabel` | `string` | `"Unfollow"` | Shown while hovering a followed button. |
| `count` | `number` | `1284` | Followers besides you, shown beside the button. |
| `countLabel` | `string` | `"followers"` | Word after the count. |
| `dangerColor` | `string` | `"#dc2626"` | Colour of the unfollow warning. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height, padding and text size. |
| `defaultFollowing` | `boolean` | `false` | State on mount when uncontrolled. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `following / onFollowingChange` | `boolean / (following) => void` |  | Controlled state. |
| `className` | `string` |  | Classes for the wrapper. |

## Where it fits

- **Profiles and creator pages**: The plus folds into a check and the count ticks up, so following feels done without a toast. Pairs with [Company Card](https://uibrik.com/components/company-card.md) (Pro) and [Hover Card](https://uibrik.com/components/hover-card.md).
- **Topics and channels**: Hovering a followed item warns with Unfollow in red, which stops accidental unsubscribes.
- **Suggested people lists**: Each button eases to its new width in place, so a list of suggestions never shifts as you follow. Pairs with [Team Roster](https://uibrik.com/components/team-roster.md) (Pro).

## Same shelf: State Changes

- [Live Kbd](https://uibrik.com/components/live-kbd.md): Shortcut keycaps that sink as you press the real keys, then fire the action, so people learn the shortcut by using it.
- [Mute Toggle](https://uibrik.com/components/mute-toggle.md): A sound toggle whose waves fold away one at a time before a slash cuts through the speaker, and come back in reverse.
- [Notification Bell](https://uibrik.com/components/notification-bell.md): A notification bell that swings when something new arrives, rolls its badge count up, and drops the badge into the bell once read.
- [Password Peek](https://uibrik.com/components/password-peek.md): A password field whose eye blinks as you toggle it, and whose characters rise into view left to right instead of snapping from dots.
- [Pin Tab](https://uibrik.com/components/pin-tab.md) (Pro): A tab bar where pinning shrinks a tab to its icon and slides it to the front, and unpinning grows it back with its title.
- [Presence Dot](https://uibrik.com/components/presence-dot.md) (Pro): An avatar status dot that morphs between online, away, busy and offline, and opens from the dot itself into a tiny picker that previews each status as you hover.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/follow-button/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
