suiss/uim · Chart

Bar Chart Horizontal

Horizontal bars ranking device types by users, each in its own color.

Bar Chart Horizontal is an open-source mobile chart from suiss/uim, drawn with react-native-svg for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Bar (horizontal) on iOS in light mode

A BarChart with layout="vertical", so categories run down a YAxis and bars extend to the right, which leaves room for longer names. Each bar gets its color from chartConfig through a Cell, and the axis labels come from the same config.

Installation

$ pnpm dlx @esuiss/uim@latest add bar-chart-horizontal

The CLI also adds what it builds on: Card, Chart.

Manual

  1. Add the pieces it builds on: Card, Chart.

  2. Copy the source into components/charts/bar-chart-horizontal.tsx:

uniwind/components/charts/bar-chart-horizontal.tsx
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  Bar,
  BarChart,
  Cell,
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  XAxis,
  1. Update the import paths to match your project.

Usage

import { BarChartHorizontal } from "@/components/charts/bar-chart-horizontal"
<BarChartHorizontal />

Replace chartData with your categories and values, and add a matching entry with a label and color to chartConfig for each category. The component takes no props.