HorizontalBar
One value per category, with the names on the left where long names fit: the slowest endpoints, storage by table. Sorted from the largest.
import { HorizontalBar, RowsChartSkeleton } from '@sypnia/ui/react'
Slowest endpoints, and the skeleton
Slowest endpoints
Time to answer, 95th percentile
View as table
| Endpoint | |
|---|---|
| GET /orders?include=items | 840 ms |
| POST /checkout | 620 ms |
| GET /products/search | 410 ms |
| POST /login | 180 ms |
| GET /me | 95 ms |
Code
import { HorizontalBar, RowsChartSkeleton } from '@sypnia/ui/react';
// Long names fit on the left; sorted from the slowest.
export default function Endpoints() {
return (
<div className="sy-stack">
<HorizontalBar title="Slowest endpoints" subtitle="Time to answer, 95th percentile" label="Endpoint" formatValue={(v) => `${v} ms`}
items={[{ label: 'GET /orders?include=items', value: 840 }, { label: 'POST /checkout', value: 620 }, { label: 'GET /products/search', value: 410 }, { label: 'GET /me', value: 95 }, { label: 'POST /login', value: 180 }]} />
<RowsChartSkeleton rows={3} />
</div>
);
} When to use it
Use it when
- Rankings and categories with long names.
Do not use it when
- Values over time: use BarChart or LineChart.
For everyone
- Each row is focusable and named with its label and value.
- On phones the bar goes under the name, full width.
Props
| HorizontalBar | Type | Default |
|---|---|---|
itemsrequired | { label: string; value: number; }[] | |
titlerequired | ReactNode | |
empty | ReactNode | |
error | ReactNode | |
formatValue | Fmt | |
height | number | |
keepOrder | boolean | |
labelThe header of the first column of the table view. | string | Name |
loading | boolean | |
loadingRowsOn the first load (`loading` with no items): how many rows will come, drawn as rows of skeleton. Default 5. | number | |
subtitle | ReactNode |
| RowsChartSkeleton | Type | Default |
|---|---|---|
rows | number | 5 |