How to use a component
Scope: every shared component on every Mpalo surface.
Rule. Use the shared component and its tokens. Do not restyle it in the page. A page chooses the surface step its component sits on; the component derives its fill, hover, and selected states from that step.
A component takes on or level, the surface step of its container. The component fill is on + 1, hover is on + 2, and selected is on + 2. A card on a page is step 2; a button on that card is step 3; hover is step 4. The component never hard-codes a level.
Do: copy the shared markup and let the tokens do the work.
Do not: add a page-level background, border, radius, shadow, font size, or hover state to a shared component.
Button
One action, one consequence, one label.
- When to use
- When the person is committing an action: create, save, revoke, submit, confirm. Use a quiet text action inside a row when the action should not compete with the primary action.
- Anatomy
- Label, optional leading icon, optional pending indicator. The label is always visible. The button keeps its padding and its place in the layout when a pending state starts.
- Variants
.btnneutral,.btn-primarythe main action,.btn-successconfirm or enable,.btn-warningthe action inside a caution banner,.btn-dangerdestructive,.btn-quietsecondary text action,.btn-quiet-dangerdestructive text action.- States
- Rest is the surface step above the container. Hover is one step above rest. Focus is a 2px outline at 2px offset. Disabled is the resting fill with muted text and a not-allowed cursor. Pending keeps the label, disables pointer events, and shows a compact progress ring.
- Tokens
--surface-Nfor the fill,--accentand--on-accentfor primary, the semantic fill and on-color pair for success, warning, and danger,--radiusfor the corner,--focusfor the ring, and the linear duration tokens for hover.- Accessibility
- The label is the accessible name. An icon-only button needs an
aria-label. A pending button keeps its name and reports the pending state; do not replace the label with a spinner alone. A destructive button names the real operation, not "delete" when the operation is revocation. - Do not
- Do not center a wrapped label. Both lines start at the same left edge. Do not shrink the type or truncate the label to keep it on one line. Do not use a hollow red outline for a destructive action. Do not use a transparent button on the same surface as its container.
| Do | Do not |
|---|---|
| Use one primary action per view. | Make two buttons primary and let the person guess. |
| Write the operation: "Revoke API key". | Write "Delete" when the operation is revocation. |
Call window.mpaloPending.run(button, fn) for an async action. | Leave the button looking idle while the request runs. |
Input
A field is a question. The label says what the answer is for.
- When to use
- When the person must supply a value that the system cannot infer. Use a select when the valid values are known and finite. Use a textarea when the answer is longer than one line.
- Anatomy
- Visible label, the field, optional hint, optional error sentence. The error sits next to the field it belongs to. Required state is stated in text, not only with an asterisk.
- States
- Rest is card +1. Hover is one step up. Focus is a 2px outline with a 0 offset. Error is a red outline plus a sentence that says how to correct it. Disabled is the resting fill with muted text; it is not the only explanation for why an action is unavailable.
- Tokens
--surface-Nfor the fill,--text-1for the value,--text-mutedfor the placeholder,--redfor the error outline,--focusfor the focus ring, and--radiusfor the corner.- Accessibility
- Every field has a visible label or an accessible name that matches the visible label. The hint and error are programmatically associated with the field. The error is announced. Placeholder text never replaces a label.
- Do not
- Do not use a placeholder as the only label. Do not use color alone for an error. Do not use a disabled field to explain a permission the interface could state. Do not add a translucent fill or a border.
Select
A select is a list of valid answers, not a menu of actions.
- When to use
- When the person chooses one value from a known, finite set. Use a radio group when the options need explanation or when there are fewer than four. Use a menu when the control performs an action rather than choosing a value.
- Anatomy
- Visible label, a real
selectelement, realoptionelements, and a chevron that shows the open state. - States
- Rest and hover follow the field. Open rotates the chevron 180 degrees. The selected option is the value in the closed trigger. Disabled uses the field's disabled state.
- Tokens
- The field tokens,
--surface-Nand--text-1. The popup is a solid surface two steps above the page with--shadow-overlay. It never inherits the operating system menu styling on a product surface. - Accessibility
- The real
selectstays in the DOM with itsid,name,value, and events. The visual panel is an enhancement, not a replacement. The control has a visible label and a name that matches it. Keyboard operation follows the native select model. - Do not
- Do not build a custom dropdown from divs. Do not use a select for navigation or for a destructive action. Do not ship a bare native popup on the Mind Platform; the shared enhancer is mandatory there.
Table
A table is a set of records with the same fields. It is not a layout tool.
- When to use
- When several records share the same fields and the person needs to compare them. Use a definition list for one record. Use cards when each record has a different shape.
- Anatomy
- Caption, header row with column names, body rows. A sortable header is a button. A row action sits in a cell with its own accessible name.
- States
- Rows are solid bars at container +1, 1px apart. Hover is +1. The selected row is +2. The header is muted text with no fill. A sorted column states its direction in text and with
aria-sort. - Tokens
--surface-Nfor rows and hover,--text-1for values,--text-mutedfor headers,--gap-withinand--gap-betweenfor spacing, and the mono face for identifiers.- Accessibility
- A table has a caption and column headers. A sortable header exposes its sort state. A scroll container is keyboard reachable. The table never depends on color to distinguish a row.
- Do not
- Do not fake responsive tables with
transform: scale()and a wider width; that creates phantom horizontal scrolling. Do not put a tooltip in a cell where an SVG in the same cell can paint over it. Do not use a table for page layout.
| Name | Key | Status | Calls |
|---|---|---|---|
| Production | mp_live_4f...a2 | Active | 18,204 |
| Staging | mp_test_91...c7 | Active | 2,310 |
| Old laptop | mp_live_0b...19 | Revoked | 0 |
Badge
A badge states a condition. It is not a button and not a decoration.
- When to use
- For a short status attached to a record: Active, Revoked, Pending, Private, Low. Use a chip when the value is a token the person can remove. Use plain text when no visual status is needed.
- Anatomy
- One short word in a solid tone fill with its on-color text. The label sits slightly above center. No icon is required; if one is used it does not replace the word.
- States
- Static. The tone carries meaning only with the word. A status change replaces the badge, not its color alone.
- Tokens
- The semantic fill and on-color pair:
--greenand--on-green,--yellowand--on-yellow,--orangeand--on-orange,--redand--on-red,--purpleand--on-purple,--blueand--on-blue, plus--radius. - Accessibility
- The word is the status. Color is a second signal, never the only one. The badge is not focusable and has no click behavior.
- Do not
- Do not use a pill. Do not use a left-border accent or a tint. Do not use a badge as a button. Do not rely on green alone to mean active.
Card
A card groups one subject. It is not a container for a page.
- When to use
- When one record, one setting, or one action group needs its own solid surface. Use a section when the content is part of the page's main argument. Use a card for a discrete object the person can scan or act on.
- Anatomy
- Optional title, body, optional action row. The card has no border and no shadow. Its fill is its container's step +1.
- States
- Rest is container +1. Hover, when the whole card is a link, is +1. Selected is +2. A card does not transform, glow, scale, or shimmer.
- Tokens
--surface-Nfor the fill,--radiusfor the corner,--gap-withinand--gap-betweenfor internal and external spacing. No shadow token.- Accessibility
- If the whole card is a link, the link has a name that describes the destination. Do not nest a second interactive control inside a card link. Focus is visible on the card or on its action.
- Do not
- Do not add a border, a shadow, or a tint. Do not nest a card inside a card to create hierarchy; use a step of space instead. Do not put a marketing footer inside a card.
Production key
Requests authenticated with this key use the hosted reference path.
Modal
A modal interrupts the page. Use it only when the decision cannot wait.
- When to use
- For a decision that must be completed before the page continues: a consequential confirmation, a focused form, or a search dialog. Use a toast for a result that does not need a decision. Use an inline panel when the content can sit in the page.
- Anatomy
- Scrim, panel at the surface beneath +2, a title, the content, and the actions. The close control is always present. The panel carries
--shadow-overlayand--radius. - States
- Open, closing, and focus-trapped. Escape closes the topmost overlay. A scrim click closes it when the content is dismissible. Focus returns to the control that opened it.
- Tokens
--surface-Nfor the panel,--shadow-overlayfor the only shadow,--radiusfor the corner, and the scrim token for the one full-page translucent layer.- Accessibility
- The dialog has
role="dialog",aria-modal="true", and a name from its title. Focus enters the panel and is trapped there until it closes. Background content is inert. Escape closes it. The close control has an accessible name. - Do not
- Do not use a modal for a routine success message. Do not open a modal from a modal. Do not remove the close control. Do not use a border or a second shadow.
Toast
A toast reports a result that does not require a decision.
- When to use
- After a completed action whose outcome the person should know: saved, copied, sent, failed. Use an inline status when the message belongs to a field or a section. Use a modal when the person must decide.
- Anatomy
- Tone square, a short title, and at most one sentence. The panel sits at the surface beneath +2 with
--shadow-overlay. The tone square is a solid 8px shape, not a tint. - States
- Enter, visible, and exit. The toast does not take focus. It remains long enough to read. A destructive consequence is never delivered only by a toast.
- Tokens
- The semantic fill for the tone square,
--surface-Nfor the panel,--shadow-overlay, and--radius. - Accessibility
- The toast is an
aria-livestatus or alert region. It does not steal focus. The text states what happened, not "Success". A toast that disappears automatically still leaves the state visible on the page. - Do not
- Do not use a toast for an error the person must correct. Do not stack more than one. Do not use a tint, a border, or a left-border accent.
Copy it now. You will not see it again.
Tabs
Tabs switch between views of the same subject. They do not sequence a task.
- When to use
- When two or more views belong to one subject and the person needs to move between them without leaving the page. Use links for navigation between pages. Use a stepped form for a sequence that must be completed in order.
- Anatomy
- A tab list, a tab for each view, and one panel. The active tab has a 2px accent bar below its label. The label is text, not a filled tab.
- States
- Inactive is muted text. Hover is full text. Active is full text with the accent bar. Focus is the 2px focus ring. Disabled is muted and not focusable.
- Tokens
--text-1and--text-mutedfor labels,--accentfor the bar,--focusfor the ring, and the linear duration for the state change.- Accessibility
- Use the tab pattern:
role="tablist",role="tab",role="tabpanel",aria-selected, and arrow-key movement between tabs. The panel is associated with its tab. A tab does not navigate to another URL unless it is a link. - Do not
- Do not use tabs for a multi-step form. Do not fill the active tab with a background. Do not use tabs when the content is long enough that the person will lose the tab list while reading.
Enforcement
The component rules are checked in review and by the design checks.
- Confirm the component is the shared class and not a local copy.
- Confirm the surface step and the hover step are correct.
- Tab to the control and confirm focus is visible.
- Check the accessible name, state, and error association.
- Run
npm run check:design-rulesandnpm run check:design-runtime. - For a new component, add its rule here and its styles to
components.css. Do not add a specimen-only class.
Owner: the Design owner for the shared component; the surface owner for its use. Review: before a component or a new usage pattern ships.