Theme

npm_versionnpm Paragon package page

This component utilizes Button from React-Bootstrap and extends it with an ability to add icons before and after button label, see below for usage example.
See React-Bootstrap for additional documentation.

Core Buttons

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

Core Buttons (Inverse Pallete)

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

Utility Buttons

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

Size

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

When to use the inline size

Use inline size buttons for when a button sits with a line of text.

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

Block Buttons

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

Disabled

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

With empty href

For link to be disabled, it must have href defined with some value.

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

With Icons before or after

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

Stateful buttons

To implement loading state using a Button component, the StatefulButton component is available for use.
This specialized component is designed to seamlessly manage and display boot states, providing a more efficient and user-friendly experience.

Theme Variables#

CSS VariableComputed Value










Props API#

Button Props API

This is a pass through component from React-Bootstrap, see original props documentation here.

  • className string

    Specifies class name to apply to the button

  • disabled bool

    Disables the Button, preventing mouse events, even if the underlying component is an <a> element

    Defaultfalse
  • children node

    Specifies the text that is displayed within the button.

  • onClick func

    A function that would specify what the button should do when the onClick event is triggered. For example, the button could launch a Modal. The default is an empty function.

  • onKeyDown func

    A function that would specify what the button should do when the onKeyDown event is triggered. For example, this could handle using the Escape key to trigger the button's action. The default is an empty function.

  • type string

    Used to set the type attribute on the button tag. The default type is button.

  • variant string

    Specifies variant to use. Can be on of the base variants: primary, secondary, success, danger, warning, info, dark, light, link

    as well as one of the customized variants (= base variant prefixed with inverse-, outline- or inverse-outline-)

  • iconBefore PropTypes.elementType as Requireable<React.ComponentType>

    An icon component to render. Example import of a Paragon icon component: import { Check } from '@openedx/paragon/icons';

  • iconAfter PropTypes.elementType as Requireable<React.ComponentType>

    An icon component to render. Example import of a Paragon icon component: import { Check } from '@openedx/paragon/icons';

Usage Insights#

Button

Project NameParagon VersionInstance Count
edx-ora221.13.12
edx-platform2.6.438
frontend-app-account22.10.021
frontend-app-admin-portal21.13.1161
frontend-app-authn22.11.25
frontend-app-communications22.7.06
frontend-app-course-authoring22.8.1207
teams22.8.13
frontend-app-discussions22.7.024
frontend-app-ecommerce20.46.33
frontend-app-enterprise-public-catalog21.13.17
frontend-app-gradebook22.8.19
frontend-app-learner-dashboard22.9.022
frontend-app-learner-portal-enterprise21.13.168
frontend-app-learner-portal-programs21.13.12
frontend-app-learner-record22.10.012
frontend-app-learning22.10.045
frontend-app-library-authoring21.11.330
frontend-app-ora-grading21.11.317
frontend-app-payment22.9.03
frontend-app-profile22.10.03
frontend-app-publisher21.13.11
frontend-app-support-tools21.13.148
frontend-component-header-edx21.13.16
frontend-component-header22.10.02
catalog-search21.13.15
frontend-learner-portal-base12.2.01
frontend-lib-special-exams22.7.023
frontend-platform22.8.11
prospectus20.46.235
studio-frontend3.4.814