# C category bar 1

> Credit score — bands with a marker

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/c-category-bar-1).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-category-bar-1
- Screenshot: https://shadcn.exchange/shot/cnippet/c-category-bar-1/light.png
- Registry item: https://ui.cnippet.dev/r/c-category-bar-1.json
- Categories: category bar
- Listed: 2026-10-27, source last changed 2026-10-27

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-category-bar-1.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/category-bar`

## Files

### `registry/default/chart-variants/c-category-bar-1.tsx`

```tsx
"use client";

import { CategoryBar } from "@/registry/default/charts/category-bar";

const SCORE = 712;

export default function CreditScore() {
  return (
    <div className="w-full max-w-sm rounded-lg border bg-card p-5">
      <div className="text-muted-foreground text-sm">Credit score</div>
      <div className="mt-1 flex items-baseline gap-2">
        <span className="font-semibold text-3xl tabular-nums">{SCORE}</span>
        <span className="text-sm text-success-foreground">Good</span>
      </div>
      {/* Bands start at 300: poor 300–580, fair –670, good –740, excellent –850. */}
      <CategoryBar
        className="mt-5"
        colors={[
          "var(--destructive)",
          "var(--warning)",
          "var(--success)",
          "var(--info)",
        ]}
        labels={["Poor", "Fair", "Good", "Excellent"]}
        marker={SCORE - 300}
        valueFormatter={(value) => String(value + 300)}
        values={[280, 90, 70, 110]}
      />
    </div>
  );
}
```
