export const title = "Metric components" export const description = "Powerful and customizable React metric components built for modern applications and websites. These metric components are built using React Aria and styled with Tailwind CSS." import * as Demos from "@/components/application/metrics/metrics.demo.tsx";
## Installation You can add this metrics component using our CLI or manually: ```bash npx untitledui@latest add metrics ``` Copy the files below into your project: Great! Now you can start using the metrics components in your project by just copy/pasting our examples below. ## Metrics examples Below are examples and variations of this metrics component: ### Simple {{ tocOnly:true }}
### Simple actions {{ tocOnly:true }}
### Icon 01 {{ tocOnly:true }}
### Icon actions 01 {{ tocOnly:true }}
### Icon 02 {{ tocOnly:true }}
### Icon actions 02 {{ tocOnly:true }}
### Icon 03 {{ tocOnly:true }}
### Icon actions 03 {{ tocOnly:true }}
### Icon 04 {{ tocOnly:true }}
### Icon actions 04 {{ tocOnly:true }}
### Chart 01 {{ tocOnly:true }}
### Chart actions 01 {{ tocOnly:true }}
### Chart 02 {{ tocOnly:true }}
### Chart actions 02 {{ tocOnly:true }}
### Chart 03 {{ tocOnly:true }}
### Chart actions 03 {{ tocOnly:true }}
### Chart 04 {{ tocOnly:true }}
### Chart actions 04 {{ tocOnly:true }}
## API reference `. Omit `footer` or pass `null` to render the card without one.", }, { question: "Can I pass my own data to the metric charts?", answer: "Yes. `MetricsChart01` accepts `chartData` as an array of `{ value: number; highlight?: boolean }`, where `highlight: true` renders the emphasized dot on that point. `MetricsChart03` and `MetricsChart04` accept `chartData` as an array of `{ value: number }`, plus `chartColor`, `chartAreaFill` and `chartCurveType` (a Recharts `CurveType`) for customizing the area itself.", }, { question: "How do I change the icon on a metric card?", answer: "`MetricsIcon03`, `MetricsIcon04` and `MetricsChart02` accept an `icon` prop that takes an icon component, such as one from `@untitledui/icons`. `MetricsIcon01` and `MetricsIcon02` use fixed icons, so edit the component file if you need to swap those.", }, { question: "How do I hide the actions dropdown on a metric card?", answer: "Set `actions={false}`. That prop is available on `MetricsIcon03`, `MetricsIcon04` and `MetricsChart01`; on the other cards the dots dropdown is always rendered, so remove the `ActionsDropdown` element in the component file to drop it. Every card also accepts `className` if you only need to restyle the container.", }, ]} />