--- title: Bar List description: Used to display categorical data with horizontal bars, showing comparisons between different categories or items links: storybook: charts-bar-list--basic --- ## Usage ```tsx import { BarList, Chart, useChart } from "@chakra-ui/charts" ``` ```tsx ``` ## Examples ### Sort Order Set the `sort` key to `{ by: "value", direction: "asc" }` to sort the bars in ascending order. ```ts const chart = useChart({ sort: { by: "value", direction: "asc" }, // ... }) ``` ### Format Value Pass the `valueFormatter` prop to the `BarList.Value` component to format the value of the bars. ```tsx /valueFormatter={(value) => value.toLocaleString()}/ value.toLocaleString()} /> ``` ### Labels To add name and value labels to the bars, use the `BarList.Label` component. ```tsx ``` ### Link To make the bars render a link, pass the `label` prop to the `BarList.Bar` component. ```tsx {payload.name}} /> ``` ### Tooltip Pass the `tooltip` prop to the `BarList.Bar` component to show a tooltip when hovering over the bar. ### Multiple values Here's an example of how to render the value and percent of the bars.