# Labelled Line Chart Card

> Card with a single-series line chart of average session minutes by month, each point labelled with its value, and a footer note on the trend. Client component on recharts 3.8.

A shadcn/ui block from the [@01orbital](https://01orbital.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/01orbital/line-chart-01).

- Page, with a live preview: https://shadcn.exchange/r/01orbital/line-chart-01
- Screenshot: https://shadcn.exchange/shot/01orbital/line-chart-01/light.png
- Registry item: https://01orbital.dev/r/line-chart-01.json
- Categories: charts
- Listed: 2026-11-01, source last changed 2026-11-01

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/01orbital/line-chart-01.json
```

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

## Dependencies

- npm packages: `recharts`
- Registry items: `card`, `@01orbital/chart`

## Files

### `blocks/charts/line-chart-01/index.tsx`

```tsx
"use client"

import { CartesianGrid, LabelList, Line, LineChart, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  type ChartConfig,
} from "@/components/ui/chart"

// The copy: change text here, not in the markup.
const COPY = {
  title: "Average session",
  description: "Minutes per session, May to October 2026",
  note: "Sessions run longer since offline albums shipped in August.",
} as const

const AVERAGE_SESSION = [
  { month: "May", minutes: 21 },
  { month: "June", minutes: 24 },
  { month: "July", minutes: 23 },
  { month: "August", minutes: 29 },
  { month: "September", minutes: 33 },
  { month: "October", minutes: 35 },
]

const CHART_CONFIG = {
  minutes: { label: "Minutes", color: "var(--chart-2)" },
} satisfies ChartConfig

export default function LineChart01() {
  return (
    <Card className="mx-auto w-full max-w-md">
      <CardHeader>
        <CardTitle>
          <h2>{COPY.title}</h2>
        </CardTitle>
        <CardDescription>{COPY.description}</CardDescription>
      </CardHeader>
      <CardContent>
        <ChartContainer config={CHART_CONFIG}>
          <LineChart
            accessibilityLayer
            data={AVERAGE_SESSION}
            margin={{ top: 24, left: 16, right: 16 }}
          >
            <CartesianGrid vertical={false} />
            {/* Stock ChartContainer's label color misses recharts 3's label layer. */}
            <XAxis
              tick={{ fill: "var(--muted-foreground)" }}
              dataKey="month"
              tickLine={false}
              axisLine={false}
              tickMargin={8}
              tickFormatter={(value: string) => value.slice(0, 3)}
            />
            <ChartTooltip
              cursor={false}
              content={<ChartTooltipContent indicator="line" />}
            />
            <Line
              dataKey="minutes"
              type="natural"
              stroke="var(--color-minutes)"
              strokeWidth={2}
              dot={{ fill: "var(--color-minutes)" }}
              activeDot={{ r: 6 }}
            >
              <LabelList
                position="top"
                offset={12}
                className="fill-foreground"
                fontSize={12}
              />
            </Line>
          </LineChart>
        </ChartContainer>
      </CardContent>
      <CardFooter className="text-sm text-muted-foreground">
        <p>{COPY.note}</p>
      </CardFooter>
    </Card>
  )
}
```
