# C bar list 3

> Clickable referrers — rows filter the dashboard

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-list-3).

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

## Install

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

## Files

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

```tsx
"use client";

import { useState } from "react";
import { BarList } from "@/registry/default/charts/bar-list";
import { ChartCard } from "@/registry/default/charts/chart-card";

const referrers = [
  { name: "google.com", value: 18420 },
  { name: "github.com", value: 9310 },
  { name: "news.ycombinator.com", value: 6280 },
  { name: "x.com", value: 4170 },
  { name: "reddit.com", value: 2960 },
];

export default function ClickableReferrers() {
  const [selected, setSelected] = useState<string | null>(null);

  return (
    <ChartCard
      className="max-w-md"
      description="Click a referrer to filter the dashboard"
      footer={
        selected ? (
          <span>
            Filtered to{" "}
            <span className="font-medium text-foreground">{selected}</span>
          </span>
        ) : (
          "No filter applied"
        )
      }
      title="Referrers"
    >
      <BarList
        aria-label="Visitors by referrer"
        data={referrers}
        onValueClick={(item) => setSelected(item.name)}
      />
    </ChartCard>
  );
}
```
