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 Variable | Computed Value |
|---|---|
| | |
| | |
| | |
| | |
| | |
Props API#
This is a pass through component from React-Bootstrap, see original props documentation here.
- className
stringSpecifies class name to apply to the button
- disabled
boolDefaultfalseDisables the Button, preventing mouse events, even if the underlying component is an
<a>element - children
nodeSpecifies the text that is displayed within the button.
- onClick
funcA function that would specify what the button should do when the
onClickevent is triggered. For example, the button could launch aModal. The default is an empty function. - onKeyDown
funcA function that would specify what the button should do when the
onKeyDownevent is triggered. For example, this could handle using theEscapekey to trigger the button's action. The default is an empty function. - type
stringUsed to set the
typeattribute on thebuttontag. The default type isbutton. - variant
stringSpecifies variant to use. Can be on of the base variants:
primary,secondary,success,danger,warning,info,dark,light,linkas well as one of the customized variants (= base variant prefixed with
inverse-,outline-orinverse-outline-) - iconBefore
elementType|nodeAn icon component to render. Example import of a Paragon icon component:
import { Check } from '@openedx/paragon/icons'; - iconAfter
elementType|nodeAn icon component to render. Example import of a Paragon icon component:
import { Check } from '@openedx/paragon/icons';
Usage Insights#
Button
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| edx-platform | 2.6.4 | 40 | |
| frontend-app-account | 20.46.3 | 20 | |
| frontend-app-admin-portal | 20.46.3 | 136 | |
| frontend-app-authn | 20.46.2 | 5 | |
| frontend-app-communications | 20.46.2 | 6 | |
| frontend-app-course-authoring | 21.5.6 | 102 | |
| frontend-app-discussions | 20.46.3 | 23 | |
| frontend-app-ecommerce | 20.46.2 | 3 | |
| frontend-app-enterprise-public-catalog | 20.46.3 | 5 | |
| frontend-app-gradebook | 20.45.0 | 9 | |
| frontend-app-learner-dashboard | 20.46.2 | 39 | |
| frontend-app-learner-portal-enterprise | 20.45.4 | 47 | |
| frontend-app-learner-portal-programs | 20.45.5 | 2 | |
| frontend-app-learner-record | 20.46.3 | 12 | |
| frontend-app-learning | 20.46.0 | 45 | |
| frontend-app-library-authoring | 21.5.6 | 29 | |
| frontend-app-ora-grading | 20.46.3 | 17 | |
| frontend-app-payment | 20.46.2 | 3 | |
| frontend-app-profile | 20.46.3 | 3 | |
| frontend-app-publisher | 20.46.3 | 1 | |
| frontend-app-support-tools | 20.46.0 | 35 | |
| frontend-component-header-edx | 21.5.6 | 6 | |
| frontend-component-header | 21.5.6 | 3 | |
| catalog-search | 20.45.0 | 5 | |
| frontend-learner-portal-base | 12.2.0 | 1 | |
| frontend-lib-content-components | 21.5.6 | 33 | |
| frontend-lib-special-exams | 20.44.0 | 23 | |
| frontend-platform | 21.5.6 | 1 | |
| prospectus | 20.46.2 | 47 | |
| studio-frontend | 3.4.8 | 14 |