Ballmac UI home

State View

Shows the right thing for what the data is doing: a skeleton while loading, a helpful empty state, an error with retry, or your content. Announced to screen readers, never steals focus, fades with the theme's motion.

6/6 checksv1.0.1Updated Oct 12, 2026Ships with a test
What changed
  1. 1.0.1 Oct 12, 2026Moves frameProps into its own frame-props module so server components can use it; state-view still exports it.
  2. 1.0.0 Oct 12, 2026First release.

Update without losing your edits

Recent activity

  • Maya Jensen approved the Q4 launch plan

    2m ago
  • Dev Patel commented on Pricing page

    18m ago
  • Sana Okafor shipped build 482 to production

    1h ago
  • Lucas Meyer invited 3 teammates

    3h ago

Installation

$ pnpm dlx shadcn@latest add @ballmac/state-view

Usage

import { StateView, frameProps } from "@/components/ballmac/state-view"

The full example is in the Code tab above.

Examples

With a real fetch

Invoices

Loading

API reference

<StateView>

PropTypeDefault
state*

What to show. `submitting` and `success` belong to forms and render the children.

BlockState—
loading

Shown while loading. Make it the same shape as the ready content so nothing jumps. A plain set of lines is used if you leave it out.

React.ReactNode—
empty

Copy and action for the empty state, or your own node.

EmptyConfig | React.ReactNode—
error

Copy for the error state, or your own node.

ErrorConfig | React.ReactNode—
onRetry

Called by the retry button. Without it the button is not drawn.

() => void—
label

Text announced to assistive technology while loading.

string—
bare

Drop the empty and error panels' border and tint, for use inside a frame that already has them.

booleanfalse
children

The ready content.

React.ReactNode—

<State>

PropTypeDefault
state

What the block shows. Defaults to `ready`.

BlockState—
onRetry

Called by the retry button in the error state. Without it the button is not drawn.

() => void—
emptyState

Copy and action for the empty state.

EmptyConfig—
errorState

Copy for the error state.

ErrorConfig—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Screen readerLoading is announced as a status; an error is announced as an alert; the region is aria-busy while loading
TabReaches the retry button and the details disclosure; focus is never moved for you

Quality scorecard

6/6

Every applicable check passes

Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.0.1, across 2 examples.

How we measure
  • Passed: Accessibility scan

    No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).

  • Passed: Small screens

    No sideways scrolling at 360, 390 or 1280 px wide.

  • Passed: Reduced motion

    Every endless animation stops when the visitor asks for less motion.

  • Not applicable: Right to left

    Not mirrored by design: A sentence is one line of text, so its words keep their order in the demo's English; the line itself starts on the right. In Arabic or Hebrew the words reverse by themselves.

  • Passed: Clean console

    No console errors or React hydration errors while loading.

  • Passed: Keyboard

    3 tab stops, each showing a visible change when it takes focus. 2 documented keys.

  • Not applicable: Loading, empty and error

    Does not show data or take submissions.

  • Passed: Automated tests

    Covered by block-states.test.tsx, dashboard-states-pro.test.tsx and 2 more.

  • For information: Footprint

    2.5 KB of source (gzip) in 1 file. Installs lucide-react.

Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.

Use with AI

Wrap any data view: <StateView state={state} loading={<MySkeleton/>} empty={{ title, description, action }} error={{ title, description, details }} onRetry={retry}>{ready content}</StateView>. Pair with useResource, which returns the state. Loading is announced and the region is aria-busy; errors use role=alert; focus is never moved. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI State View (@ballmac/state-view) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Any list, table, feed or panel that loads data
  • Giving a block its loading, empty and error views without writing them each time

Not for

  • Forms: they track submitting and success themselves (blocks with a state prop handle it)
  • A single value that is just a number: use a skeleton line

Registry JSON: https://ui.ballmac.com/r/state-view.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

311 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.