UNPKG

@cimpress/react-components

Version:
79 lines 2.38 kB
import React, { PropsWithoutRef, ReactNode } from 'react'; import { PublicComponentProps } from './types'; type Size = 'default' | 'sm' | 'lg'; type Variant = 'default' | 'secondary' | 'primary' | 'link' | 'anchor'; type Color = 'primary' | 'danger'; export interface ButtonProps extends PublicComponentProps { /** * The unique identifier for the button. */ id?: string; /** * The ability to make the button fill the content block. */ blockLevel?: boolean; /** * The inner contents of the button. */ children?: ReactNode; /** * The ability to disable the button. */ disabled?: boolean; /** * The ability to make the button navigate to a url. */ href?: string; /** * Specify navigation behavior */ target?: '_blank' | '_parent' | '_self' | '_top'; /** * Icon to display as the button content. */ icon?: ReactNode; /** * The callback function used when the onMouseEnter event occurs. */ onMouseEnter?: (e: any) => void; /** * The callback function used when the onMouseLeave event occurs. */ onMouseLeave?: (e: any) => void; /** * The callback function used when a button is clicked. */ onClick?: (e: any) => void; /** * The size of the button you are creating. */ size?: Size; /** * The variant of button you are creating. */ variant?: Variant; color?: Color; type?: PropsWithoutRef<React.ButtonHTMLAttributes<HTMLButtonElement>>['type'] | (string & {}); } export interface ATagProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> { children?: ReactNode; icon?: ReactNode; href?: string; target?: string; disabled?: boolean; size?: string; onClick?: any; className?: string; } export interface ButtonTagProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> { children?: ReactNode; icon?: ReactNode; disabled?: boolean; size?: string; onClick?: any; className?: string; type?: PropsWithoutRef<React.ButtonHTMLAttributes<HTMLButtonElement>>['type'] | (string & {}); } export declare const Button: ({ blockLevel, className, disabled, icon: originalIcon, onClick, size, variant, color, ...rest }: ButtonProps) => React.JSX.Element; export {}; //# sourceMappingURL=Button.d.ts.map