chart-area-legend
showcase-elevenlabs/chart-area-legendFreeBlock
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/elevenlabs/showcase/main/apps/www/public/r/styles/new-york/chart-area-legend.jsonSource
1"use client"23import { TrendingUp } from "lucide-react"4import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"56import {7 Card,8 CardContent,9 CardDescription,10 CardFooter,11 CardHeader,12 CardTitle,13} from "@/registry/new-york/ui/card"14import {15 ChartConfig,16 ChartContainer,17 ChartLegend,18 ChartLegendContent,19 ChartTooltip,20 ChartTooltipContent,21} from "@/registry/new-york/ui/chart"22const chartData = [23 { month: "January", desktop: 186, mobile: 80 },24 { month: "February", desktop: 305, mobile: 200 },25 { month: "March", desktop: 237, mobile: 120 },26 { month: "April", desktop: 73, mobile: 190 },27 { month: "May", desktop: 209, mobile: 130 },28 { month: "June", desktop: 214, mobile: 140 },29]3031const chartConfig = {32 desktop: {33 label: "Desktop",34 color: "hsl(var(--chart-1))",35 },36 mobile: {37 label: "Mobile",38 color: "hsl(var(--chart-2))",39 },40} satisfies ChartConfig4142export default function Component() {43 return (44 <Card>45 <CardHeader>46 <CardTitle>Area Chart - Legend</CardTitle>47 <CardDescription>48 Showing total visitors for the last 6 months49 </CardDescription>50 </CardHeader>51 <CardContent>52 <ChartContainer config={chartConfig}>53 <AreaChart54 accessibilityLayer55 data={chartData}56 margin={{57 left: 12,58 right: 12,59 }}60 >61 <CartesianGrid vertical={false} />62 <XAxis63 dataKey="month"64 tickLine={false}65 axisLine={false}66 tickMargin={8}67 tickFormatter={(value) => value.slice(0, 3)}68 />69 <ChartTooltip70 cursor={false}71 content={<ChartTooltipContent indicator="line" />}72 />73 <Area74 dataKey="mobile"75 type="natural"76 fill="var(--color-mobile)"77 fillOpacity={0.4}78 stroke="var(--color-mobile)"79 stackId="a"80 />81 <Area82 dataKey="desktop"83 type="natural"84 fill="var(--color-desktop)"85 fillOpacity={0.4}86 stroke="var(--color-desktop)"87 stackId="a"88 />89 <ChartLegend content={<ChartLegendContent />} />90 </AreaChart>91 </ChartContainer>92 </CardContent>93 <CardFooter>94// … truncated
What it pulls in
Other registry items
Files it writes
More from shadcn/ui
All 357 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| calendar-01calendar-01 | shadcn/ui | Blocks | Free | no deps | |
| calendar-02calendar-02 | shadcn/ui | Blocks | Free | no deps | |
| calendar-03calendar-03 | shadcn/ui | Blocks | Free | no deps | |
| calendar-04calendar-04 | shadcn/ui | Blocks | Free | no deps | |
| calendar-05calendar-05 | shadcn/ui | Blocks | Free | no deps | |
| calendar-06calendar-06 | shadcn/ui | Blocks | Free | no deps | |
| calendar-07calendar-07 | shadcn/ui | Blocks | Free | no deps | |
| calendar-08calendar-08 | shadcn/ui | Blocks | Free | no deps |
