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
string
Specifies class name to apply to the button
- disabled
bool
DefaultfalseDisables the Button, preventing mouse events, even if the underlying component is an
<a>
element - 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 aModal
. 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 theEscape
key to trigger the button's action. The default is an empty function. - type
string
Used to set the
type
attribute on thebutton
tag. The default type isbutton
. - 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-
orinverse-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 Name | Paragon Version | Instance Count | |
---|---|---|---|
edx-ora2 | 21.13.1 | 2 | |
edx-platform | 2.6.4 | 38 | |
frontend-app-account | 22.10.0 | 21 | |
frontend-app-admin-portal | 21.13.1 | 161 | |
frontend-app-authn | 22.11.2 | 5 | |
frontend-app-communications | 22.7.0 | 6 | |
frontend-app-course-authoring | 22.8.1 | 207 | |
teams | 22.8.1 | 3 | |
frontend-app-discussions | 22.7.0 | 24 | |
frontend-app-ecommerce | 20.46.3 | 3 | |
frontend-app-enterprise-public-catalog | 21.13.1 | 7 | |
frontend-app-gradebook | 22.8.1 | 9 | |
frontend-app-learner-dashboard | 22.9.0 | 22 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 68 | |
frontend-app-learner-portal-programs | 21.13.1 | 2 | |
frontend-app-learner-record | 22.10.0 | 12 | |
frontend-app-learning | 22.10.0 | 45 | |
frontend-app-library-authoring | 21.11.3 | 30 | |
frontend-app-ora-grading | 21.11.3 | 17 | |
frontend-app-payment | 22.9.0 | 3 | |
frontend-app-profile | 22.10.0 | 3 | |
frontend-app-publisher | 21.13.1 | 1 | |
frontend-app-support-tools | 21.13.1 | 48 | |
frontend-component-header-edx | 21.13.1 | 6 | |
frontend-component-header | 22.10.0 | 2 | |
catalog-search | 21.13.1 | 5 | |
frontend-learner-portal-base | 12.2.0 | 1 | |
frontend-lib-special-exams | 22.7.0 | 23 | |
frontend-platform | 22.8.1 | 1 | |
prospectus | 20.46.2 | 35 | |
studio-frontend | 3.4.8 | 14 |