Skip to main content

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.

ComponentFilePurpose
ButtonButton.tsxCore button. Adds optional tooltip, confirmation dialog, and automatic loading-state detection for form actions. Accepts an actionType prop and passes through MUI Button props.
ButtonCancelButtonCancel.tsxCancel / 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.
ButtonCopyButtonCopy.tsxCopies a string to the clipboard. Shows a checkmark icon on success and auto-resets after a configurable delay.
ButtonExpandButtonExpand.tsxDropdown menu button. Renders a list of menuItems, each with its own onClick, disabled flag, and optional tooltip. Toggles an expand/collapse icon.
ButtonHoldButtonHold.tsxHold-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.
ButtonHoldRawButtonHoldRaw.tsxHold-to-activate primitive. Renders an animated fill bar overlay; the onHoldComplete callback fires after a 2-second hold. Used directly inside HoldCancelButtons.
ButtonOpenLinkNewTabButtonOpenLinkNewTab.tsxOpens an href in a new tab with rel="noopener noreferrer". Includes an OpenInNew icon.
ButtonToggleButtonToggle.tsxMUI ToggleButton with stable background colour across hover and selected states. Accepts selectedcolor and textcolor for theming and an optional border outline when selected.
ButtonTooltipButtonTooltip.tsxAlways-disabled button wrapped in a Tooltip. Use when an action is unavailable and the reason should be surfaced on hover.
ButtonTranslateButtonTranslate.tsxThin MUI Button wrapper used in the translation workflow. Accepts loading and disabled and forwards label and click handler.