‹ components

MarginHealth

draftv0.9.0·open in canvas

Margin-ratio meter for trading accounts, with tiered risk labels and semantic buy/warning/sell/error tones.

Installnpx shadcn add @cids/margin-health
Live demo
Margin ratioHealthy37.00%
37%

Motion · tap to replay

honors reduced-motion

Bar width transitions over 300ms. The label and value change immediately so risk is never hidden behind animation.

Brand chip remounts on tap · highlighted tokens are named in this component's doc · spring is budgeted to human feedback only.

import { MarginHealth } from "@/design-system";

<MarginHealth value={37.42} />

Tokens · live

Resolves in the active theme — flip the toggle above to verify.

States · from doc

Parsed from the doc. Interact with the live demo for hover/active.

healthycautionhighcriticalzeroclamped overflow.

Margin-ratio meter for trading accounts, with tiered risk labels and semantic buy/warning/sell/error tones.

Anatomy

Margin ratio  [==========..............]  Healthy  37.42%

Props

PropTypeDefaultNotes
valuenumber--Percent, clamped to 0-100.
labelstringMargin ratioVisible label and meter name.
precisionnumber2Percent decimals.
classNamestring--cn-merged.

Thresholds are fixed: <50 healthy, 50-79.99 caution, 80-89.99 high, >=90 critical.

Motion

Bar width transitions over 300ms. The label and value change immediately so risk is never hidden behind animation.

A11y

Self-contained: copy the folder into any Tailwind+React app, or use the install command above. Docs and this page render the same file on disk — they cannot drift.