Status
import { Status, STATUS_HUE } from '@hanzo/ui'
Variants
Success, warning, error, info and gray, each with a matching dot.
Default
Operational
Degraded
Down
Scheduled
Paused
export function Variants() {
return (
<XStack flexWrap="wrap" gap="$3" items="center">
<Status>Default</Status>
<Status variant="success">Operational</Status>
<Status variant="warning">Degraded</Status>
<Status variant="error">Down</Status>
<Status variant="info">Scheduled</Status>
<Status variant="gray">Paused</Status>
</XStack>
)
}Without a dot
The dot is optional for a plain label.
Draft
Published
export function NoDot() {
return (
<XStack gap="$3">
<Status dot={false}>Draft</Status>
<Status variant="success" dot={false}>
Published
</Status>
</XStack>
)
}In a list
One status per row, naming each service's state at a glance.
API
Operational
Queue
Degraded
Search
Down
export function ServiceList() {
const services = [
{ name: 'API', variant: 'success' as const, label: 'Operational' },
{ name: 'Queue', variant: 'warning' as const, label: 'Degraded' },
{ name: 'Search', variant: 'error' as const, label: 'Down' },
]
return (
<YStack gap="$2">
{services.map((service) => (
<XStack key={service.name} justify="space-between" width={220}>
<SizableText size="$2">{service.name}</SizableText>
<Status variant={service.variant}>{service.label}</Status>
</XStack>
))}
</YStack>
)
}Types
export type StatusVariant = 'default' | 'success' | 'warning' | 'error' | 'info' | 'gray'export type StatusProps = Omit<ComponentProps<typeof StatusFrame>, 'variant' | 'color'> & {
variant?: StatusVariant | null
/** A data hue or a semantic name: the record status look. */
color?: DataHue | StatusVariant | (string & {})
/** Busy: a spinner after the label, `aria-busy` on the pill. */
loading?: boolean
weight?: 'regular' | 'medium'
/** Show the leading dot. Defaults to true — the dot is the point of a status pill. */
dot?: boolean
}Exports
Statustype StatusPropstype StatusVariantSTATUS_HUE