UNPKG

@cbinsights/fds

Version:
55 lines (54 loc) 2.26 kB
import React, { HTMLAttributes } from 'react'; export declare const SIZES: readonly ["s", "m"]; export declare const THEMES: readonly ["blue", "orange", "outlined", "outlined--blue", "ghost"]; export declare type Theme = typeof THEMES[number]; export interface ButtonProps extends HTMLAttributes<HTMLElement | HTMLButtonElement | HTMLAnchorElement> { /** Text inside the button */ label: string; /** Used to control the display and theme of the button */ theme?: Theme; /** * Controls whether button should be in a destructive UI state. * This only influences UI, there is no functional differences enabled * with this boolean */ isDestructive?: boolean; /** Used to control the size of the button */ size?: typeof SIZES[number]; /** Pass in "only" a FDS Icon reference to display it (e.g. IconRight={ApproveIcon}) */ IconRight?: any; /** Pass in "only" a FDS Icon reference to display it (e.g. IconLeft={ApproveIcon}) */ IconLeft?: any; /** Controls showing CaretDown icon (right aligned) */ hasCaret?: boolean; /** * Controls whether the button is disabled or not. Will control the disabled * presentation of either an anchor or button rendered under the hood, * but will only add a disabled attribute for buttons */ disabled?: boolean; /** Controls the button going full width */ isFullWidth?: boolean; /** Controls showing of an active UI state for the button */ isActive?: boolean; /** * Controls whether loading spinner displays. Button text and icons are set to visibility hidden * to preserve the space set, whilst hiding them */ isLoading?: boolean; /** * Takes in a react-router `Link` reference and sets it * as the base element. You may ONLY use it like the * following: * * - `import { Link } from 'react-router'` * - `Link={Link}` */ Link?: any; /** Extend click radius of button to nearest relative parent */ isBreakoutLink?: boolean; href?: string; } export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<unknown>>; export declare type ButtonType = React.ReactElement<ButtonProps>; export default Button;