@engie-group/fluid-design-system-react
Version:
Fluid Design System React
66 lines (65 loc) • 2.07 kB
TypeScript
import React, { PropsWithChildren } from 'react';
import { WithHTMLAttributes } from '../../utils/typeHelpers';
export declare const NJButton: React.ForwardRefExoticComponent<TButtonProps & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
export type TButtonSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'normal';
export type TButtonVariant = 'primary' | 'secondary' | 'destructive' | 'inverse';
export type TButtonEmphasis = 'bold' | 'subtle' | 'minimal';
export interface IButtonAnchorProps extends WithHTMLAttributes<IButtonBaseProps, 'a'> {
href: string;
type?: never;
/**
* Button link target
* @deprecated Prefer using `target` props.
*/
hrefTarget?: string;
/**
* Button link rel
* @deprecated Prefer using `rel` props.
*/
hrefRel?: string;
}
export interface IButtonButtonProps extends WithHTMLAttributes<IButtonBaseProps, 'button'> {
href?: never;
}
export type TButtonProps = IButtonAnchorProps | IButtonButtonProps;
export interface IButtonBaseProps extends PropsWithChildren {
/**
* Button size, avoid using deprecated `normal`value, use `medium` instead
*/
size?: TButtonSize;
/**
* Button variant theme
*/
variant?: TButtonVariant;
/**
* Button emphasis
*/
emphasis?: TButtonEmphasis;
/**
* Button text
*/
label?: string;
/**
* Text alternative for assistive technologies
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
* @deprecated Prefer using `aria-label` props.
*/
ariaLabel?: string;
/**
* Whether button is disabled or not
* @deprecated Prefer using `disabled` props.
*/
isDisabled?: boolean;
/**
* Whether button is loading or not
*/
isLoading?: boolean;
/**
* Button material icon name (from https://material.io/resources/icons/?style=baseline)
*/
icon?: string;
/**
* Optional additional className for icon
*/
iconClassName?: string;
}