# Trust and analytics bento

> An adoption metric and a security review checklist, each with a color image placeholder, beside a service availability strip.

- Kind: block · Category: Bento · Interactivity: native
- Install: `npx shadcn@latest add @haze/bento-trust-analytics`
- File: `src/components/haze/blocks/bento-trust-analytics.astro`
- npm dependencies: none
- Registry dependencies: @haze/bento-checklist, @haze/bento-tile, @haze/collapsible, @haze/section-heading, @haze/uptime-tracker, @haze/utils
- Docs page: https://hazeui.com/blocks/bento-trust-analytics

## Use when
- A product section puts adoption figures next to a security review.
- Readers need the underlying period values, availability history and named controls.

## Avoid when
- The page must carry authoritative audit evidence or a live incident feed.

## Alternatives
- [bento-operations](https://hazeui.com/blocks/bento-operations.md)
- [bento-growth](https://hazeui.com/ui/bento-growth.md)
- [uptime-tracker](https://hazeui.com/ui/uptime-tracker.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | bento-trust-analytics | no | Unique ID prefix for the section heading. |
| title | `string` |  | no | Visible section title. |
| description | `string` |  | no | Context for the metrics and review. |
| headingLevel | `1 \| 2 \| 3` | 2 | no | Heading level for the section. |
| adoption | `Adoption` |  | no | Metric name, formatted value and comparison. |
| samples | `Sample[]` |  | no | Nonnegative historical values in period order, with an optional displayValue for each figure in the disclosure. |
| uptime | `UptimePeriod[]` |  | no | Service periods with labels and availability states. |
| controls | `CheckItem[]` |  | no | Review items and their states. |
| class | `string` |  | no | Classes on the section. |

## 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.
- Key Enter / Space: Expand or collapse the adoption values.

## Agent prompts

### 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": "https://hazeui.com/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: https://hazeui.com/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.

## Example requests that should lead here
- Display active workspaces, recent API availability and the security review checklist, with image tiles.

## Source

```astro
---
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>
```
