Repository URL to install this package:
|
Version:
4.0.29 ▾
|
import { ReactNode } from 'react';
export interface ButtonRenderProp {
(props: ButtonProps, state: ButtonState): ReactNode;
}
/**
* PROPS
*/
export interface BaseButtonProps {
className?: string;
breedType?: string;
iconType?: string;
direction?: string;
text?: string;
width?: string | number;
/**
* @description 'prefix' | 'suffix'
* used to change the alignment position of the icon
*/
iconAlignType?: string;
to?: string;
form?: string;
/**
* @alias text | value | children
*/
children?: ReactNode;
dataQa?: string;
/**
* renderProps
*/
renderWrap?: ButtonRenderProp;
renderIcon?: ButtonRenderProp;
renderIconWrapper?: ButtonRenderProp;
renderText?: ButtonRenderProp;
renderChildren?: ButtonRenderProp;
}
/**
* STATES
*/
export interface ButtonState {
/**
* @description used for the focus state
* => when cursor is on hover/focus on the button
*/
isFocused: boolean;
/**
* @description used for the active state
* => when the button get pressed and went to active state
*/
isActive: boolean;
/**
* @description used for the selected state
* => when the button gets pressed and still in active
*/
isSelected: boolean;
/**
* @description used for the disable state
* => when the buttons gets deactivated from default mode
*/
isDisabled: boolean;
}
/**
* @description WCAG PROPS
*/
export interface ButtonAccessibilityProps {
/**
* @description used to set the role to the button
* <div role="button">
*/
role?: string;
/**
* @description used to set aria-label
*/
'aria-label'?: string;
/**
* @alias aria-label | aria-labelledby
*/
'aria-labelledby'?: string;
/**
* @description used to maintain the pressed state
*/
'aria-pressed'?: boolean | string;
/**
* @description id / identifier of the button
*/
id?: string;
/**
* @description used to set tabIndex for WCAG complaince
*/
tabIndex?: string | number;
}
export interface ButtonProps extends BaseButtonProps, ButtonAccessibilityProps {
}