Trust and analytics bento
An adoption metric and a security review checklist, each with a color image placeholder, beside a service availability strip.
pnpm dlx shadcn@latest add @haze/bento-trust-analytics---
import { cn } from "../../../lib/haze/utils";
import BentoChecklist from "../ui/bento-checklist.astro";
import BentoTile from "../ui/bento-tile.astro";
import Collapsible from "../ui/collapsible.astro";
import SectionHeading from "../ui/section-heading.astro";
import UptimeTracker from "../ui/uptime-tracker.astro";
interface Props {
id?: string;
title?: string;
description?: string;
headingLevel?: 1 | 2 | 3;
adoption?: { label: string; value: string; comparison: string };
samples?: { label: string; value: number; displayValue?: string }[];
uptime?: { label: string; status: "operational" | "degraded" | "outage" | "no-data" }[];
controls?: { label: string; detail?: string; state?: "done" | "current" | "pending" }[];
class?: string;
}
const {
id = "bento-trust-analytics", title = "Adoption and reliability, together", headingLevel = 2,
description = "Workspace growth alongside service availability and the current security review.",
adoption = { label: "Active workspaces", value: "2,480", comparison: "+16% vs last month" },
samples = [
{ label: "Jun", value: 1620 }, { label: "Jul", value: 1800 }, { label: "Aug", value: 1730 },
{ label: "Sep", value: 1960 }, { label: "Oct", value: 2138 }, { label: "Nov", value: 2480 },
],
uptime = [
{ label: "Mon", status: "operational" }, { label: "Tue", status: "operational" },
{ label: "Wed", status: "operational" }, { label: "Thu", status: "degraded" },
{ label: "Fri", status: "operational" }, { label: "Sat", status: "operational" }, { label: "Sun", status: "operational" },
],
controls = [
{ label: "Recovery drill", detail: "Completed Nov 14", state: "done" },
{ label: "Access review", detail: "Review underway", state: "current" },
{ label: "Key rotation", detail: "Due Nov 27", state: "pending" },
],
class: className,
} = Astro.props;
const tileHeading = ({ 1: 2, 2: 3, 3: 4 } as const)[headingLevel];
const values = samples.filter(({ value }) => Number.isFinite(value) && value >= 0);
const operational = uptime.filter(({ status }) => status === "operational").length;
---
<section aria-labelledby={`${id}-title`} class={cn("bg-background px-5 py-12 sm:px-8 sm:py-18", className)}>
<div class="mx-auto grid max-w-6xl gap-7 sm:gap-10">
<SectionHeading id={`${id}-title`} title={title} description={description} headingLevel={headingLevel} />
<div data-bento-grid class={cn("grid min-w-0 gap-3 md:gap-4", controls.length > 0 && "md:grid-cols-[minmax(0,1.45fr)_minmax(0,1fr)]")}>
<BentoTile title={adoption.label} description={`${adoption.value} · ${adoption.comparison}`} headingLevel={tileHeading} visualClass="flex-1">
<div slot="visual" aria-hidden="true" class="min-h-44 sm:min-h-56"></div>
{values.length > 0 && (
<Collapsible title="View values" class="rounded-lg bg-background/65">
<dl class="grid min-w-0 gap-1">
{values.map(({ label, value, displayValue }) => (
<div class="flex min-w-0 flex-wrap justify-between gap-x-3">
<dt class="wrap-anywhere">{label}</dt><dd class="font-mono wrap-anywhere text-foreground">{displayValue ?? value}</dd>
</div>
))}
</dl>
</Collapsible>
)}
</BentoTile>
{uptime.length > 0 && (
<BentoTile title="Service availability" headingLevel={tileHeading} bodyClass="items-start gap-3 sm:grid-cols-[auto_minmax(0,1fr)] sm:gap-6">
<p class="grid min-w-0 gap-1">
<span class="text-3xl/9 font-semibold tracking-tight tabular-nums">{operational}<span class="text-lg/6 text-muted-foreground"> / {uptime.length}</span></span>
<span class="text-xs/4 text-muted-foreground">Periods operational</span>
</p>
<UptimeTracker label="API availability" periods={uptime} class="gap-2 rounded-none border-0 bg-transparent p-0 inset-shadow-none" />
</BentoTile>
)}
{controls.length > 0 && (
<BentoTile title="Security review" headingLevel={tileHeading} class="md:col-start-2 md:row-span-2 md:row-start-1"
visualClass="flex-1 bg-foreground/6">
<div slot="visual" aria-hidden="true" class="min-h-44 sm:min-h-56"></div>
<BentoChecklist label="Security review checklist" items={controls} />
</BentoTile>
)}
</div>
</div>
</section>When to use
- A product section puts adoption figures next to a security review.
- Readers need the underlying period values, availability history and named controls.
When not to use
- The page must carry authoritative audit evidence or a live incident feed.
Installation
Add the Haze registry to components.json once, then install Trust and analytics bento with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/bento-trust-analyticsnpx shadcn@latest add @haze/bento-trust-analyticsyarn dlx shadcn@latest add @haze/bento-trust-analyticsbunx --bun shadcn@latest add @haze/bento-trust-analyticsFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | bento-trust-analytics | Unique ID prefix for the section heading. |
| title | string | – | Visible section title. |
| description | string | – | Context for the metrics and review. |
| headingLevel | 1 | 2 | 3 | 2 | Heading level for the section. |
| adoption | Adoption | – | Metric name, formatted value and comparison. |
| samples | Sample[] | – | Nonnegative historical values in period order, with an optional displayValue for each figure in the disclosure. |
| uptime | UptimePeriod[] | – | Service periods with labels and availability states. |
| controls | CheckItem[] | – | Review items and their states. |
| class | string | – | Classes on the section. |
Keyboard interactions
- EnterSpace
- Expand or collapse the adoption values.
Accessibility
- Each color field stands in for a product image and is aria-hidden.
- Adoption values and availability periods each have a text equivalent.
- Every review item has an accessible state.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI block "Trust and analytics bento" with `npx shadcn@latest add @haze/bento-trust-analytics`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import BentoTrustAnalytics from "@/components/haze/blocks/bento-trust-analytics.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/bento-trust-analytics.md
Customize with real content
Adapt the Haze bento-trust-analytics block for our product. Replace the demo values of these props with our real content: id, title, description, headingLevel, adoption, samples, uptime, controls, class. Keep the layout, the heading level rules and these accessibility details: Each color field stands in for a product image and is aria-hidden. Adoption values and availability periods each have a text equivalent. Every review item has an accessible state. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using bento-trust-analytics, check it fits: use it when a product section puts adoption figures next to a security review.; readers need the underlying period values, availability history and named controls.. Avoid it when the page must carry authoritative audit evidence or a live incident feed.. Alternatives: @haze/bento-operations, @haze/bento-growth, @haze/uptime-tracker.
Dependencies
- @haze/bento-checklist
- @haze/bento-tile
- @haze/collapsible
- @haze/section-heading
- @haze/uptime-tracker
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.