Status badges, tags and inline notices for runs and records.
QueuedRunningWaiting for approvalSucceededFailed
Invoice sync is paused. Resume
Only admins can change spend limits.
Runs every weekday at 9:00.
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { NoticeView, StatusBadge } from "./ui/uicontext/components/kit/Status.ts"import { sx } from "./ui/uicontext/components/Sx.ts"const styles = stylex.create({ stack: { display: "grid", gap: 12, inlineSize: "min(100%, 32rem)" }, row: { display: "flex", flexWrap: "wrap", gap: 8 },})export const RunStatuses = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.stack)).children( h.div.attrs(sx(styles.row)).children( StatusBadge(h, { tone: "neutral", label: "Queued" }), StatusBadge(h, { tone: "info", label: "Running" }), StatusBadge(h, { tone: "warning", label: "Waiting for approval" }), StatusBadge(h, { tone: "success", label: "Succeeded" }), StatusBadge(h, { tone: "danger", label: "Failed" }), ), // a refusal is announced as an alert; the rest politely NoticeView(h, { tone: "warning", text: "Invoice sync is paused.", href: "#resume", linkLabel: "Resume" }), NoticeView(h, { tone: "danger", text: "Only admins can change spend limits." }), NoticeView(h, { tone: "info", text: "Runs every weekday at 9:00." }), )Installation
pnpm dlx shadcn@latest add checkfu/uicontext/statusUsage
import { NoticeView, StatusBadge } from "./ui/uicontext/components/kit/Status.ts"export const RunState = <M>(h: Html.H<M>) => StatusBadge(h, { tone: "info", label: "Running" })export const PausedNotice = <M>(h: Html.H<M>) => NoticeView(h, { tone: "warning", text: "This workflow is paused.", href: "/workflows/invoice-sync/settings", linkLabel: "Resume" })API reference
StatusBadgeView function
Options
| Name | Type | Description |
|---|---|---|
tonerequired | "neutral" | "accent" | "danger" | "warning" | "success" | "info" | The dot's color, for what the status means. |
labelrequired | string | The status in a word or two. |
ConfirmDialogView function
Options
| Name | Type | Default | Description |
|---|---|---|---|
openrequired | boolean | — | Whether the dialog shows. The caller keeps it. |
titlerequired | string | — | The question, naming what goes: "Delete Website?". |
descriptionrequired | string | — | What happens, and whether it can be undone. |
confirmLabelrequired | string | — | The confirm button's text, a verb: "Delete project". |
onCancelrequired | Message | — | Sent on Escape and on Cancel. |
onConfirmrequired | Message | — | Sent by the confirm button. |
confirmDisabled | boolean | — | Keeps the confirm button disabled, as until a name is typed |
body | View.Children | — | More content between the description and the buttons, such as a field to type the name. |
key | string | "confirm" | Names the confirmation among dialogs in the same view, "confirm" by default; its title may change |
Accessibility
- A status badge's dot is hidden from screen readers; its words carry the status.
- A notice is a
status, or analertwhen it's a refusal, so it's announced when it appears.VisuallyHiddenholds text for screen readers only. - The confirm dialog is a modal that names what goes; Escape and Cancel back out.