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:
| Value | Label | Tone | Meaning |
|---|---|---|---|
none | None | neutral | No access. |
view | View | view (muted blue) | Read-only. |
edit | Edit | accent (orange) | Read + write own records. |
full | Full Access | primary (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, andtone. The tone maps to the StatusBadge visual. disabledon individual options prevents selection without removing them from the group.- For custom levels beyond the defaults, pass your own
optionsarray.
Related
- RadioGroup — generic single-select without access-level semantics.
- StatusBadge — standalone status pill used inside the group.
- CheckboxGrid — multi-select equivalent for permissions.