@spark-web/button
Version:
--- title: Button storybookPath: forms-buttons-button--default isExperimentalPackage: true ---
38 lines (37 loc) • 1.54 kB
TypeScript
import type { BackgroundTone } from '@spark-web/a11y';
import type { IconProps } from '@spark-web/icon';
import type { DataAttributeMap } from '@spark-web/utils/internal';
import type { ButtonHTMLAttributes, ReactElement } from 'react';
import type { mapTokens } from './utils';
export declare type ButtonSize = keyof typeof mapTokens[keyof typeof mapTokens];
export declare type ButtonProminence = 'high' | 'low' | 'none';
export declare type ButtonTone = Exclude<BackgroundTone, 'disabled'>;
declare type ChildrenWithText = {
label?: never;
children: string | number | [ReactElement<IconProps>, string | number] | [string | number, ReactElement<IconProps>];
};
declare type IconOnly = {
/**
* Implicit label for buttons only required for icon-only buttons
* for accessibility reasons.
*/
label: string;
children: ReactElement<IconProps>;
};
export declare type ButtonChildrenProps = ChildrenWithText | IconOnly;
export declare type NativeButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
export declare type CommonButtonProps = {
/** Sets data attributes for the element. */
data?: DataAttributeMap;
/** Unique identifier for the underlying element. */
id?: string;
} & ButtonChildrenProps & ButtonStyleProps;
export declare type ButtonStyleProps = {
/** Sets the visual prominence of the button. */
prominence?: ButtonProminence;
/** Sets the size of the button. */
size?: ButtonSize;
/** Sets the tone of the button. */
tone?: ButtonTone;
};
export {};