RestraintAudit
A development aid: watches the rendered page for the countable rules of the UI guidelines (one accent button per view, no nested cards, no stacked dialogs, no tabs in tabs, four key figures, one banner, 44px touch targets) and reports what breaks them in the console. Renders nothing; does nothing in production.
When to use
A development aid: watches the rendered page for the countable rules of the UI guidelines (one accent button per view, no nested cards, no stacked dialogs, no tabs in tabs, four key figures, one banner, 44px touch targets) and reports what breaks them in the console.
Accessibility
Fully keyboard operable: Tab to focus, Enter/Space to activate. The visible focus ring uses --focus-ring — never remove it. Provide an accessible label (aria-label) for icon-only controls.
Install and import
npx shadcn@latest add @prism/restraint-audit
import { RestraintAudit } from '@/components/prism/RestraintAudit';
In a no-build prototype, read it from the bundle instead: const { RestraintAudit } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
enabled | boolean | — | Run the audit. Default: true in a development build, false in production. |
outline | boolean | — | Outline the offending elements (sets data-restraint="<rule>" on them). Default true. |
onReport | (findings: RestraintFinding[]) => void | — | Called with the findings whenever they change, e.g. to fail an end-to-end test. |
root | Element | string | — | The element, or a selector for it, to audit. Default: the document body. |