npm_versionnpm Paragon package page

The stateful button is a button used to display an actionable icon.

Basic usage

Any Paragon component or export may be added to the code example.

Custom icons and disabled states

Any Paragon component or export may be added to the code example.

Custom states with Paragon icons

Any Paragon component or export may be added to the code example.

Props API#

StatefulButton Props API
  • className string

    Optionally specify additional CSS classes to give this button.

  • state string

    Each state has:

    • A label (required)
    • An icon
    • an option to be disabled

    Control the state with the state prop. Example usage:

    <StatefulButton
      state="pending"
      labels={{
        default: 'Download',
        pending: 'Downloading',
        complete: 'Downloaded',
      }}
      icons={{
        default: <Icon className="fa fa-download" />,
        pending: <Icon className="fa fa-spinner fa-spin" />,
        complete: <Icon className="fa fa-check" />,
      }}
      disabledStates=['pending']
      className='btn-primary mr-2'
    />
    
    Default'default'
  • labels { [key: string]: React.ReactNode } Required

    Each state has a label. Required.

  • icons { [key: string]: React.ReactNode }

    Each state has an icon.

    Default{ default: undefined, pending: <Icon src={SpinnerSimple} className={classNames('icon-spin')} />, complete: <Icon src={CheckCircleOutline} />, error: <Icon src={Cancel} />, }
  • disabledStates string[]

    Each state has a disabledState

    Default['pending', 'complete']

Usage Insights#

StatefulButton

Project NameParagon VersionInstance Count
frontend-app-account22.10.08
frontend-app-admin-portal21.13.126
frontend-app-authn22.11.27
frontend-app-communications22.7.01
frontend-app-course-authoring22.8.117
ora_settings22.8.11
proctoring22.8.11
xpert_unit_summary22.8.12
frontend-app-discussions22.7.02
frontend-app-ecommerce20.46.31
frontend-app-gradebook22.8.11
frontend-app-learner-dashboard22.9.01
frontend-app-learner-portal-enterprise21.13.110
frontend-app-learner-portal-programs21.13.11
frontend-app-learner-record22.10.01
frontend-app-learning22.10.01
frontend-app-library-authoring21.11.34
frontend-app-ora-grading21.11.32
frontend-app-payment22.9.03
frontend-app-profile22.10.01
frontend-app-publisher21.13.11
frontend-app-support-tools21.13.12
frontend-learner-portal-base12.2.02
frontend-lib-special-exams22.7.01