Theme

PlaygroundBeta

npm_versionnpm Paragon package page

StatefulButton

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.28.58
frontend-app-admin-portal20.26.315
frontend-app-authn20.34.07
frontend-app-communications20.28.51
frontend-app-course-authoring20.32.03
frontend-app-discussions20.15.02
frontend-app-gradebook19.25.41
frontend-app-learner-dashboard20.19.01
frontend-app-learner-portal-enterprise20.31.17
frontend-app-learner-portal-programs20.28.41
frontend-app-learner-record20.28.41
frontend-app-learning20.28.41
frontend-app-library-authoring20.30.14
frontend-app-ora-grading19.9.02
frontend-app-payment20.18.22
frontend-app-profile20.32.31
frontend-app-publisher20.28.51
frontend-learner-portal-base12.2.02
frontend-lib-special-exams20.22.41