goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
34 lines • 1.4 kB
TypeScript
import { default as React } from 'react';
import { ButtonProps } from './index';
export interface SaveButtonProps extends Omit<ButtonProps, 'text' | 'action' | 'variant' | 'icon' | 'disabled' | 'type'> {
/**
* Whether the form is valid. The button is only enabled when `valid` is
* `true` (and not `pending`). This is the green↔grey gate every save button
* shares.
*/
valid: boolean;
/**
* Whether a save is in flight. While `true` the label becomes a spinner +
* `'Saving…'` and the button is disabled to block double-submits.
*/
pending: boolean;
/**
* Click handler. Aliased to the button's `onClick` so callsites read as
* `onSave`. Optional — some forms submit via the surrounding `<form>` and
* just need the gated `type="submit"` button.
*/
onSave?: (event: React.MouseEvent<HTMLButtonElement>) => void;
/** Idle label. Default `'Save'`. */
label?: string;
/** Label shown while `pending`. Default `'Saving…'`. */
pendingLabel?: string;
/**
* Singular entity noun the save targets (e.g. `"contract"`). Forwarded to
* CustomButton as `subject` → emitted as `data-subject` and carried on the
* `action.invoke` diag.
*/
subject?: string;
}
declare const SaveButton: React.FC<SaveButtonProps>;
export default SaveButton;
//# sourceMappingURL=SaveButton.d.ts.map