---
title: "Card Brand"
description: "Shows the badge of a card network: Visa, Mastercard, American Express, UnionPay, and 10 more. Each badge has its own fill, so it shows in light and dark."
url: https://gelatinui.com/components/card-brand
markdown_url: https://gelatinui.com/components/card-brand.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/card-brand"
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Card Brand

> Shows the badge of a card network: Visa, Mastercard, American Express, UnionPay, and 10 more. Each badge has its own fill, so it shows in light and dark.

Page: https://gelatinui.com/components/card-brand

## When to use it

Best for: Show which card network a saved card or a typed number belongs to.

- Use it next to the last four digits of a saved card.
- Use it in the network slot of a Credit Card.
- Pass `null` for an unknown network: it shows the generic card.
- Set the height with `className` (`h-6`). The width follows at 38:24.

## When not to use it

- For a large card face with the number and the holder, use a [Credit Card](https://gelatinui.com/components/credit-card.md).
- For a status or a count, use a [Badge](https://gelatinui.com/components/badge.md).

## Notes for agents

- `brand` takes a `CardBrandId` from `@/lib/card-number-model`, or `null` for the generic card.
- Mir and Troy show the generic card: they have no free badge.
- It is decorative (`aria-hidden`). Say the brand in text next to it, or pass `aria-label` and `role="img"`.
- The marks are trademarks. Do not recolor them.

## Anatomy

```text
CardBrand
```

## API reference

### CardBrand

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `brand` | `CardBrandId \| null` |  | The network (`#/lib/card-number-model`), or `null` for the generic card. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| CardBrand | `card-brand` |  |  |  |

## Usage

Say the network in text next to the badge, or give the badge a name with `aria-label` and `role="img"`.

```tsx title="saved-card.tsx"
import { CardBrand } from "@/components/ui/pro/card-brand";

export function SavedCard() {
  return (
    <div className="flex items-center gap-3 text-sm">
      <CardBrand brand="visa" className="h-6" />
      <span>Visa ending in 4242</span>
    </div>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/card-brand
```

It adds 7 registry items: 7 files, 1152 lines, and the npm packages `clsx`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Credit Card](https://gelatinui.com/components/credit-card.md)
- [Choice Card](https://gelatinui.com/components/choice-card.md)
- [Badge](https://gelatinui.com/components/badge.md)

## Accessibility

The badge is `aria-hidden` by default, because the text next to it says the brand.

With `aria-label` it is not hidden: add `role="img"` so screen readers read the name.
