Skip to content
opsinjs
Edit this page

opsinjs

Components

Sixty components in twelve categories, each installed as source you own.

Every component is shipped, which means its source installs and renders and its API may change in any release. Each was audited against WCAG 2.2 AA by its own authors. None has had an independent accessibility review or a clinical review, so none is ready for a production health surface.

Install

npx shadcn@latest add @opsinjs/<name>

The CLI copies the component's source and the opsinjs lib/ files it reads into your project, and adds its npm dependencies. <name> is the id in each link below. Add the @opsinjs entry to components.json first, as Getting started shows.

Usage

import { Button } from "@/components/ui/button"
<Button variant="primary" onClick={save}>
  Save reading
</Button>

The import path follows the ui alias in components.json.

Health data display

ComponentUse it for
ResultCardOne test result in full
RangeBarOne reading against its range
ScoreDialA composite score and its band
TrendSparklineOne measurement over time
MetricTileOne reading at a glance
StatusPillA status your product assigned
RangeLegendThe key to a RangeBar's tones
TimelineEntryOne dated event in a history
GoalRingProgress towards a goal the product set

Health communication

ComponentUse it for
AlertBannerSomething the reader must know now
CareCardOne instruction at a stated urgency
TermA clinical word, explained
ConsentSheetAsking permission for one thing
DisclaimerNoteThe not-medical-advice note
SourceCitationWhere health information came from

Health input

ComponentUse it for
LogSheetRecording one reading, dose or note
ReadingInputTyping a measurement with its unit
BodyMapPointing at a body region
ScaleInputA self-report on the product's scale
DoseTrackerDoses already logged, shown as facts
QuestionnaireThe product's questions, with progress
SymptomPickerSymptoms from the product's list

Health formatting

ComponentUse it for
ValueAny number with its unit
RelativeTimeWhen something happened

Actions and forms

ComponentUse it for
ButtonAn action the reader presses
LinkGoing somewhere else
FieldLabel, hint and error for any input
IconButtonAn icon-only action
SwitchA setting that applies at once
CheckboxOne option ticked on or off
RadioGroupOne choice from a short list
SelectOne choice from a long list
NumberFieldA non-clinical count with steppers
TextareaA free-text note
SliderA coarse, non-clinical preference
ComboboxTyping to narrow a long list
ComponentUse it for
SegmentedControlSwitching between a few views
TabBarTop-level destinations on a phone
StepperWhere the reader is in a sequence
TabsPanels that share one region
AccordionSections that expand and collapse

Surfaces

ComponentUse it for
SurfaceThe layer under every panel and card
CardA bordered group of related content
SheetA panel that slides up
DialogA question that must be answered first

Feedback

ComponentUse it for
CalloutA note, tip or caveat
EmptyStateA screen with nothing on it yet
SkeletonThe shape of content still loading
ToastConfirming the reader's own action
ProgressHow far through a task
SpinnerA brief wait of unknown shape

Overlay

ComponentUse it for
TooltipA label the reader can do without
PopoverA small panel anchored to its control
MenuActions opened from a button

Data display

ComponentUse it for
TableRows and columns, and a chart's twin
BadgeA neutral count or word, never status

Layout

ComponentUse it for
DividerA hairline between two groups
ScrollAreaScrolling inside a card or panel

Utility

ComponentUse it for
AvatarA person's picture or initials
VisuallyHiddenText only screen readers announce

Choosing a component

Start from your data, and from who assigned any status it carries.

  • A measurement the reader interprets is a ResultCard, or a RangeBar when its place in the range is the point. A MetricTile that needs interpreting is a ResultCard at the wrong size.
  • A ScoreDial implies a composite index, so it never shows a single measurement.
  • Status appears only where a rule your product owns assigned it, and no component computes one. A category, a trend or a position against a range is not a status. See Two colour axes.
  • Allow at most one urgent surface per screen. See Alerts.
  • Decide what each component renders in all five data states: empty, loading, error, stale and partial. See States.
Not written yet.

A rule for choosing between input components. Until then, read each component's page.

Bundle size

You copy source, so you ship only what you import. Per-component sizes are not measured yet. The limit more likely to bite is the budget of three overlapping composited surfaces in Materials.

This table has not been generated. It is produced by scripts/build-registry.mts. Run pnpm run generate and reload.

Nothing on this site types a measured number by hand, so an ungenerated table shows this rather than an example.