Examples
Status tracker Pro
A row of bars, one per period, coloured by status: a service's uptime or a habit's streak at a glance, as status pages draw it. Press, hover or arrow through it for each period's details. Screen readers hear how many periods had each status.
import { StatusTracker } from '@patine-ui/pro';
Loading…
<StatusTracker data={days} accessibilityLabel="API uptime, last 45 days" style={{ width: 360 }} />
Try the props
heightdesign<StatusTracker data={uptime} />
Example: a status page
A service's public status page: one row per component over the last 60 days, its uptime beside the name, and each bar's tooltip says what happened that day.
Loading…
<VStack gap="lg" style={{ width: '100%' }}> {SERVICES.map((s) => ( <VStack key={s.name} gap="xs"> <HStack justify="space-between"> <Text weight="medium">{s.name}</Text> <Text size="sm" color="textSecondary">{s.uptime} uptime</Text> </HStack> <StatusTracker data={s.data} height={28} showLegend={false} accessibilityLabel={`${s.name}, last 60 days`} /> </VStack> ))} </VStack>
Statuses
The defaults are an uptime page's: ok (Operational, the theme's success colour), warning (Degraded), error (Down, danger) and none (No data). Pass statuses to name and colour your own; a colour is a theme colour name or any CSS colour.
<StatusTracker
data={habit}
statuses={{ done: { label: 'Done', color: 'primary' }, missed: { label: 'Missed', color: 'border' } }}
/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | { status, tooltip? }[] | — | One bar per period, oldest first. |
statuses | Record<string, { label, color }> | uptime statuses | |
height | number | 32 | |
width | number | fills the container | |
showLegend | boolean | true | Each status with its count. |
showTooltip | boolean | true | |
accessibilityLabel | string | — | |
animate | boolean | true | |
loading | boolean | false | A pulsing placeholder in place of the bars. |
theme / design | provider's | Bar gaps and corners follow the design. |