@octopusdeploy/design-system-components
Version:
The design systems component library.
85 lines (84 loc) • 2.85 kB
TypeScript
import * as React from "react";
import type { MenuTargetAriaAttributes } from "../Menu/useMenuState";
export interface ActionButtonProps {
/**
* The label of the button.
*
* This is not shown if any children are passed to the button.
*/
label: string;
/**
* The accessible name of the button.
*/
accessibleName?: string;
/**
* The title of the button.
*
* This is shown when hovering over the button.
*/
title?: string;
/**
* The label to show when the button is busy processing a click.
*/
busyLabel?: string;
/**
* Controls whether the button is disabled.
*
* - Using a `boolean` will directly control whether the button is disabled.
* - Using a `Promise` will set the button to disabled until the promise has been fulfilled.
*
* The button is automatically disabled when busy.
*/
disabled?: Promise<unknown> | boolean | null;
/**
* Controls the appearance of the button.
*/
type?: ActionButtonType;
/**
* The icon to show next to the label.
*/
icon?: JSX.Element;
/**
* The tab index of the button.
*
* When omitted, the button will be keyboard focusable in sequential order.
* This can only be set to `-1` which disables the keyboard focusability of the button.
*/
tabIndex?: -1;
/**
* Sets the form owner of the button element
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form
*/
formId?: string;
/**
* Controls whether the button is automatically focused when shown.
*/
keyboardFocused?: boolean;
/**
* The action to perform when the button is clicked.
*
* If this function returns a promise, the button will be set to busy while the promise is pending.
* When the button is busy, it is disabled and shows the `busyLabel` if provided.
*/
onClick?(event: React.MouseEvent): Promise<unknown> | void;
/**
* If the button opens a menu, these ARIA attributes should be provided for accessibility.
*/
menuButtonAttributes?: MenuTargetAriaAttributes;
}
export declare enum ActionButtonType {
Primary = "Primary",
Secondary = "Secondary",
Ternary = "Ternary",
Save = "Save",
Delete = "Delete"
}
/**
* @deprecated
* Deprecated: 27/03/2026
* Replacement: Button.tsx
* Migration guidelines:
* - The disabled prop no longer supports a Promise. Rely on an async onClick handler, or pass in a boolean instead.
* - The busyLabel prop is no longer supported.
*/
export declare function ActionButton({ label, accessibleName, title, busyLabel, disabled: disabledPromise, type, icon, tabIndex, keyboardFocused, onClick, formId, menuButtonAttributes }: ActionButtonProps): import("react/jsx-runtime").JSX.Element;