MiHCM
primitives/@mihcm/ui·v0.21.0·stable

AccessLevelGroup

4-state segmented button: None / View / Edit / Full Access. Each option has its own brand color when active.

Use cases

  • Per-module access in a role editor — None / View / Edit / Full Access.
  • Any discrete 4-level selector where each level has its own tonal weight.

When NOT to use

  • For a 2-state toggle → use Switch.
  • For free-form multi-select → use CheckboxGrid.
  • For arbitrary segmented controls → use a generic tabs / segmented-control primitive.

Levels

The default four levels match the MiHCM Security prototype:

ValueLabelToneMeaning
noneNoneneutralNo access.
viewViewview (muted blue)Read-only.
editEditaccent (orange)Read + write own records.
fullFull Accessprimary (navy)Read + write all records.

Custom levels

Pass options to override the defaults — but only for a strong reason (the four labels are tied to the prototype's permission model):

import {
  AccessLevelGroup,
  type AccessLevelOption,
} from '@mihcm/ui/AccessLevelGroup';
 
const REVIEW_LEVELS: AccessLevelOption[] = [
  { value: 'none', label: 'Not reviewed', tone: 'neutral' },
  { value: 'view', label: 'In review',    tone: 'view' },
  { value: 'edit', label: 'Approved',     tone: 'accent' },
  { value: 'full', label: 'Published',    tone: 'primary' },
];
 
<AccessLevelGroup value={status} onValueChange={setStatus} options={REVIEW_LEVELS} />

If you find yourself reaching for options for unrelated semantics, you probably want a different primitive.

Constant export

The default levels are exported as ACCESS_LEVELS so you can read them without re-declaring:

import { ACCESS_LEVELS } from '@mihcm/ui/AccessLevelGroup';

Composition

  • Each option needs value, label, and tone. The tone maps to the StatusBadge visual.
  • disabled on individual options prevents selection without removing them from the group.
  • For custom levels beyond the defaults, pass your own options array.
  • RadioGroup — generic single-select without access-level semantics.
  • StatusBadge — standalone status pill used inside the group.
  • CheckboxGrid — multi-select equivalent for permissions.