Ballmac UI home

Cost 1: cloud cost explorer

Where the cloud bill goes: the total against last period and the budget in words, spend by service as a treemap, a waterfall of what changed since last period, and unusual costs with their cause to mark as looked at.

State

The normal view. Pick a state to see what the block shows while it loads, is empty or fails.

Open in v0 (opens in a new tab)

Installation

$ pnpm dlx shadcn@latest add @ballmac/cost-1

Usage

Example: cost-1-demo.tsx
"use client"

import { Cost1 } from "@/components/ballmac/blocks/cost-1/cost-1"

export default function Cost1Demo() {
  return <Cost1 onAcknowledge={() => new Promise((r) => setTimeout(r, 400))} />
}

States

Pass state and the block does the rest: skeletons that match its layout, a clear empty message, an error you can retry, and announcements for screen readers.

  • Loading

    Skeleton for the figures, the treemap and the waterfall under the real heading, announced as loading.

    state="loading"
  • No cost data yet

    Says no cost data yet; emptyState sets the copy.

    state="empty"
  • Could not load

    An alert saying nothing was changed, with Try again (onRetry). A failed acknowledgement keeps the cost listed and says why.

    state="error"

Dependencies

Use with AI

A cloud cost explorer. <Cost1 periods={[{ id, label, total, previous, budget?, items: [{ id, label, value, group? }], bridge: [{ id, label, value, kind?: 'total' }], anomalies?: [{ id, service, amount, text }] }]} currency='USD' defaultPeriod='now' onAcknowledge={(anomaly) => Promise} />. The period control switches everything. The comparison and the budget are written in words ('$1,640 more than the period before', '$240 left of $16,000'). With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Cost 1: cloud cost explorer (@ballmac/cost-1) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • A FinOps or engineering-management view of infrastructure spend
  • Explaining why a bill moved

Not for

  • A customer's invoice; use invoice-1
  • Usage against a plan quota; use the usage-meter component

Registry JSON: https://ui.ballmac.com/r/cost-1.json

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.