mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-29 15:44:22 +00:00
* feat(v4): update home page * fix * fix: cards * feat(v4): charts page * feat: update pages * feat: colors * fix * feat: add docs * feat: mdx work * fix * fix * fix: sidebar * fix: lint * feat: updates * feat: update components * feat: fix docs * fix: responsive * feat: implement cmdk * fix: update navigation menu demo * fix: code style * fix: themes * feat: implement blocks page * fix: docs config * refactor * fix: outputFileTracingIncludes * fix * fix: output * fix * fix: registry * refactor: move docs * debug: docs * debug * revert * fix: mjs * deps: pin fumadocs * debug * fix: downgrade next * fix: index page * refactor: move mdx components * fix: remove copy button * fix * was it zod * yes it was * remove copy page * fix: color page * fix: colors page * fix: meta colors * fix: copy button * feat: sync registry * fix: registry build script * feat: update port * feat: clean up examples * fix * fix: mobile nav * fix: blur for mobile * fix: sidebar nav * feat: update examples * fix: build scripts * feat: update components * feat: restyle * fix: types * fix: styles * fix: margins * fix: screenshots * fix * feat: update theme * fix: charts nav * fix: image * feat: optimize images * fix: menu * fix: card * fix: border * check * feat: implement charts page * fix: charts * fix: og images * feat: extend touch * fix: static * fix: sizing * fix: mobile screenshots * fix: page nav * fix * feat: update favicon * fix: theme selector * fix: feedback * fix: sink * docs: update * fix: styles * chore: update registry * fix: command * fix * fix: minor updates * fix: typography on smaller devices * fix: format * fix: remove unused icon * feat: update favicon * fix: typography * docs: typography page * fix: steps
22 lines
2.6 KiB
JSON
22 lines
2.6 KiB
JSON
{
|
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
"name": "chart-tooltip-default",
|
|
"type": "registry:block",
|
|
"author": "shadcn (https://ui.shadcn.com)",
|
|
"registryDependencies": [
|
|
"card",
|
|
"chart"
|
|
],
|
|
"files": [
|
|
{
|
|
"path": "charts/chart-tooltip-default.tsx",
|
|
"content": "\"use client\"\n\nimport { Bar, BarChart, XAxis } from \"recharts\"\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"@/registry/default/ui/card\"\nimport {\n ChartConfig,\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n} from \"@/registry/default/ui/chart\"\nconst chartData = [\n { date: \"2024-07-15\", running: 450, swimming: 300 },\n { date: \"2024-07-16\", running: 380, swimming: 420 },\n { date: \"2024-07-17\", running: 520, swimming: 120 },\n { date: \"2024-07-18\", running: 140, swimming: 550 },\n { date: \"2024-07-19\", running: 600, swimming: 350 },\n { date: \"2024-07-20\", running: 480, swimming: 400 },\n]\n\nconst chartConfig = {\n running: {\n label: \"Running\",\n color: \"hsl(var(--chart-1))\",\n },\n swimming: {\n label: \"Swimming\",\n color: \"hsl(var(--chart-2))\",\n },\n} satisfies ChartConfig\n\nexport default function Component() {\n return (\n <Card>\n <CardHeader>\n <CardTitle>Tooltip - Default</CardTitle>\n <CardDescription>\n Default tooltip with ChartTooltipContent.\n </CardDescription>\n </CardHeader>\n <CardContent>\n <ChartContainer config={chartConfig}>\n <BarChart accessibilityLayer data={chartData}>\n <XAxis\n dataKey=\"date\"\n tickLine={false}\n tickMargin={10}\n axisLine={false}\n tickFormatter={(value) => {\n return new Date(value).toLocaleDateString(\"en-US\", {\n weekday: \"short\",\n })\n }}\n />\n <Bar\n dataKey=\"running\"\n stackId=\"a\"\n fill=\"var(--color-running)\"\n radius={[0, 0, 4, 4]}\n />\n <Bar\n dataKey=\"swimming\"\n stackId=\"a\"\n fill=\"var(--color-swimming)\"\n radius={[4, 4, 0, 0]}\n />\n <ChartTooltip\n content={<ChartTooltipContent />}\n cursor={false}\n defaultIndex={1}\n />\n </BarChart>\n </ChartContainer>\n </CardContent>\n </Card>\n )\n}\n",
|
|
"type": "registry:block",
|
|
"target": ""
|
|
}
|
|
],
|
|
"categories": [
|
|
"charts",
|
|
"charts-tooltip"
|
|
]
|
|
} |