# C bar chart 3

> Top pages — horizontal bars with value labels

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-bar-chart-3).

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

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet/c-bar-chart-3.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/bar-chart`, `@cnippet/chart-card`

## Files

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

```tsx
"use client";

import { BarChart } from "@/registry/default/charts/bar-chart";
import { ChartCard } from "@/registry/default/charts/chart-card";

const data = [
  { page: "/pricing", views: 48210 },
  { page: "/docs/install", views: 39870 },
  { page: "/blog/v2-launch", views: 31540 },
  { page: "/changelog", views: 22960 },
  { page: "/docs/theming", views: 18430 },
  { page: "/careers", views: 9120 },
];

export default function TopPages() {
  return (
    <ChartCard
      className="max-w-xl"
      description="Page views, last 30 days"
      title="Top pages"
    >
      <BarChart
        categories={["views"]}
        className="h-52"
        config={{ views: { color: "var(--chart-2)", label: "Views" } }}
        data={data}
        index="page"
        layout="vertical"
        showGrid={false}
        showValues
        showXAxis={false}
        yAxisWidth={112}
      />
    </ChartCard>
  );
}
```
