Buttons
All buttons live in src/lib/ui/buttons/. They wrap MUI Button or ToggleButton and layer on app-specific behaviours such as confirmation dialogs, tooltips, and form loading state.
| Component | File | Purpose |
|---|---|---|
Button | Button.tsx | Core button. Adds optional tooltip, confirmation dialog, and automatic loading-state detection for form actions. Accepts an actionType prop and passes through MUI Button props. |
ButtonCancel | ButtonCancel.tsx | Cancel / back button. Default onClick is navigateBack() from useReturnTo: an explicit onClick prop overrides everything, then a safe returnTo query param if present, then router.back(). This is the same mechanism the modal shells use with a fallback path (navigateBack(fallback)) — one priority chain, with or without a fallback, not two competing patterns. When hasChanges is true it shows a confirmation dialog before discarding. Label adapts dynamically. |
ButtonCopy | ButtonCopy.tsx | Copies a string to the clipboard. Shows a checkmark icon on success and auto-resets after a configurable delay. |
ButtonExpand | ButtonExpand.tsx | Dropdown menu button. Renders a list of menuItems, each with its own onClick, disabled flag, and optional tooltip. Toggles an expand/collapse icon. |
ButtonHold | ButtonHold.tsx | Hold-to-confirm button for medium-risk actions. Accepts the same props as Button plus color and variant. Intended for actions that need an extra intent signal without full destructive-hold UX. |
ButtonHoldRaw | ButtonHoldRaw.tsx | Hold-to-activate primitive. Renders an animated fill bar overlay; the onHoldComplete callback fires after a 2-second hold. Used directly inside HoldCancelButtons. |
ButtonOpenLinkNewTab | ButtonOpenLinkNewTab.tsx | Opens an href in a new tab with rel="noopener noreferrer". Includes an OpenInNew icon. |
ButtonToggle | ButtonToggle.tsx | MUI ToggleButton with stable background colour across hover and selected states. Accepts selectedcolor and textcolor for theming and an optional border outline when selected. |
ButtonTooltip | ButtonTooltip.tsx | Always-disabled button wrapped in a Tooltip. Use when an action is unavailable and the reason should be surfaced on hover. |
ButtonTranslate | ButtonTranslate.tsx | Thin MUI Button wrapper used in the translation workflow. Accepts loading and disabled and forwards label and click handler. |