AsyncButtonProps

Definition

interface AsyncButtonProps {
    /**
     * The caption for the button
     */
    title?: string,

    /**
     * Left side icon - supports FontAwesome, Phosphor, image URL, text/emoji, or React element
     */
    leftIcon?: ButtonIcon,

    /**
     * Right side icon - supports FontAwesome, Phosphor, image URL, text/emoji, or React element
     */
    rightIcon?: ButtonIcon,


    /**
     * Any extra css classes to add to the button 
     */
    className?: string,

    /**
     * The callback that gets invoked when the button is clicked.
     * It must return a Promise
     */
    onClick: () => Promise<any>,

    /**
     * Set button to active state when true
     */
    active?: boolean,

    /**
     * Set button to disabled state when true
     */
    disabled?: boolean,

    /**
     * Text to show when in loading state
     */
    loadingTitle?: string,

    /**
     * a callback function to call on error
     */
    onError?: (e: any) => void,

    /**
     * any custom inline styles to the button 
     */
    styles?: React.CSSProperties,

    /**
     * any custom inline styles for the icon container 
     */
    iconStyles?: React.CSSProperties,

    /**
     * Button type
     */
    type?: "button" | "submit" | "reset",

    /**
     * Button variation 
     */
    variant?: 'primary' | 'secondary' | 'danger',

    /**
     * Icon only mode
     */
    iconOnly?: boolean,

    /**
     * BELOW PROPS ARE DEPRECATED
     */

    /**
     * @deprecated Use leftIcon or rightIcon instead
     * Button icon. 
     * you can either use a url or fontawesome icon 
     * 
     * Here is a example for using fontawesome icons 
     * icon={'fas save'}
     */
    icon?: string,

    /**
     * @deprecated Use leftIcon or rightIcon instead
     * icon position
     */
    iconPosition?: 'left' | 'right',

    /**
     * @deprecated This behavior is now handled automatically by BaseButtonComponent
     * show loading spinners in place of icons (even if the icon is not there it will show the spinner on the left sides)  when the button is in loading state, 
     */
    useLoadingSpinner?: boolean,
}

Usage

Last updated