# C bar list 2

> Top countries — flags and % share

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-2).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/c-bar-list-2
- Screenshot: https://shadcn.exchange/shot/cnippet/c-bar-list-2/light.png
- Registry item: https://ui.cnippet.dev/r/c-bar-list-2.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-2.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`, `@cnippet/chart-utils`

## Files

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

```tsx
"use client";

import { BarList } from "@/registry/default/charts/bar-list";
import { ChartCard } from "@/registry/default/charts/chart-card";
import { formatPercent } from "@/registry/default/lib/chart-utils";

const countries = [
  {
    icon: <span aria-hidden="true">🇺🇸</span>,
    name: "United States",
    value: 0.382,
  },
  { icon: <span aria-hidden="true">🇩🇪</span>, name: "Germany", value: 0.124 },
  { icon: <span aria-hidden="true">🇮🇳</span>, name: "India", value: 0.117 },
  {
    icon: <span aria-hidden="true">🇬🇧</span>,
    name: "United Kingdom",
    value: 0.089,
  },
  { icon: <span aria-hidden="true">🇧🇷</span>, name: "Brazil", value: 0.061 },
];

export default function TopCountries() {
  return (
    <ChartCard
      className="max-w-md"
      description="Share of visitors, last 30 days"
      title="Top countries"
    >
      <BarList
        aria-label="Visitors by country"
        data={countries}
        valueFormatter={(value) => formatPercent(value)}
      />
    </ChartCard>
  );
}
```
