mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
- Enable all 15 finance component docs (from .disabled → .mdx) - Create stock-market.mdx, 8 chart docs, 8 block docs, 2 framework docs - Add direction.tsx component (RTL/LTR support from upstream shadcn) - Add xs/icon-xs button sizes, data-variant/data-size attributes - Fix build-registry.mts to handle default exports in namespace re-exports - Add default props to order-entry, positions-list, orders-history, trading-panel - Fix 18 navigation stubs → re-export from root implementations - Add 44 orphaned MDX files to nav (installation, dark-mode, desktop, guides, etc) - Migrate 6 framer-motion imports → motion/react - Bump React 19.2.0→19.2.4, Next.js 16.0.1→16.1.6, motion→12.34.0 - Align lucide-react, sonner v2, tailwind-merge v3, postcss-selector-parser v7 - Remove framer-motion dep (superseded by motion) - Fix @types/react-dom, TypeScript versions across workspaces
59 lines
1.3 KiB
Plaintext
59 lines
1.3 KiB
Plaintext
---
|
|
title: Bar Chart
|
|
description: Bar charts for comparing categorical data and distributions.
|
|
---
|
|
|
|
<ComponentPreview name="chart-demo" description="Bar chart example" />
|
|
|
|
## Overview
|
|
|
|
Bar charts display data with rectangular bars proportional to their values. They are ideal for comparing quantities across categories.
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@hanzo/ui"
|
|
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
|
|
const data = [
|
|
{ month: "Jan", desktop: 186 },
|
|
{ month: "Feb", desktop: 305 },
|
|
{ month: "Mar", desktop: 237 },
|
|
]
|
|
|
|
const config = {
|
|
desktop: { label: "Desktop", color: "hsl(var(--chart-1))" },
|
|
}
|
|
|
|
export function BarChartDemo() {
|
|
return (
|
|
<ChartContainer config={config}>
|
|
<BarChart data={data}>
|
|
<CartesianGrid vertical={false} />
|
|
<XAxis dataKey="month" />
|
|
<ChartTooltip content={<ChartTooltipContent />} />
|
|
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
</BarChart>
|
|
</ChartContainer>
|
|
)
|
|
}
|
|
```
|
|
|
|
## Variants
|
|
|
|
### Horizontal Bar
|
|
|
|
Use `layout="vertical"` for horizontal orientation.
|
|
|
|
### Stacked Bar
|
|
|
|
Stack multiple bars to show composition within categories.
|
|
|
|
### Mixed Bar
|
|
|
|
Combine different bar styles and data series.
|
|
|
|
### With Labels
|
|
|
|
Add data labels directly on bars using custom label components.
|