Theme

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
  • 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 Object.<node> Required

    Required. Each state has a label.

  • icons Object.<node>

    Required. 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[]

    Required. Each state has a disabledState

    Default['pending', 'complete']
  • onClick func

    Specifies the callback function when the button is clicked

Usage Insights#

StatefulButton

Project NameParagon VersionInstance Count
frontend-app-account20.46.38
frontend-app-admin-portal20.46.318
frontend-app-authn20.46.27
frontend-app-communications20.46.21
frontend-app-course-authoring21.5.613
frontend-app-discussions20.46.32
frontend-app-ecommerce20.46.21
frontend-app-gradebook20.45.01
frontend-app-learner-dashboard20.46.21
frontend-app-learner-portal-enterprise20.45.48
frontend-app-learner-portal-programs20.45.51
frontend-app-learner-record20.46.31
frontend-app-learning20.46.01
frontend-app-library-authoring21.5.64
frontend-app-ora-grading20.46.32
frontend-app-payment20.46.23
frontend-app-profile20.46.31
frontend-app-publisher20.46.31
frontend-app-support-tools20.46.02
frontend-learner-portal-base12.2.02
frontend-lib-special-exams20.44.01