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.


Button.Deprecated

(Deprecated) basic usage

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

(Deprecated) color variants

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

(Deprecated) outline variants

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

(Deprecated) inverse variants

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

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

Theme Variables (SCSS)#

$btn-padding-y: $input-btn-padding-y !default;
$btn-padding-x: $input-btn-padding-x !default;
$btn-font-family: $input-btn-font-family !default;
$btn-font-size: $input-btn-font-size !default;
$btn-line-height: $input-btn-line-height !default;
$btn-padding-y-sm: $input-btn-padding-y-sm !default;
$btn-padding-x-sm: $input-btn-padding-x-sm !default;
$btn-font-size-sm: $input-btn-font-size-sm !default;
$btn-line-height-sm: $input-btn-line-height-sm !default;
$btn-padding-y-lg: $input-btn-padding-y-lg !default;
$btn-padding-x-lg: $input-btn-padding-x-lg !default;
$btn-font-size-lg: $input-btn-font-size-lg !default;
$btn-line-height-lg: $input-btn-line-height-lg !default;
$btn-border-width: $input-btn-border-width !default;
$btn-font-weight: $font-weight-normal !default;
$btn-box-shadow: inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075) !default;
$btn-focus-width: 2px !default;
$btn-focus-gap: $btn-focus-width !default;
$btn-focus-box-shadow: $input-btn-focus-box-shadow !default;
$btn-disabled-opacity: .65 !default;
$btn-active-box-shadow: none;
$btn-tertiary-color: $gray-700 !default;
$btn-tertiary-bg: transparent !default;
$btn-tertiary-hover-bg: $light-500 !default;
$btn-tertiary-active-bg: $light-500 !default;
$btn-inverse-tertiary-color: $white !default;
$btn-inverse-tertiary-bg: transparent !default;
$btn-inverse-tertiary-hover-bg: rgba(255, 255, 255, .1) !default;
$btn-inverse-tertiary-active-bg: rgba(255, 255, 255, .1) !default;
$btn-link-disabled-color: theme-color("gray", "light-text") !default;
$btn-block-spacing-y: .5rem !default;
$btn-border-radius: $border-radius !default;
$btn-border-radius-lg: $border-radius-lg !default;
$btn-border-radius-sm: $border-radius-sm !default;
$btn-transition: null;
$btn-focus-border-gap: $btn-focus-width + $btn-focus-gap !default;
$btn-focus-distance-to-border: $btn-focus-border-gap + $btn-border-width !default;
$btn-focus-border-radius: calc(#{$btn-border-radius} + #{$btn-focus-border-gap}) !default;
$btn-focus-border-radius-lg: $btn-focus-border-radius !default;
$btn-focus-border-radius-sm: $btn-border-radius !default;

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 elementType | node

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

  • iconAfter elementType | node

    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-platform2.6.440
frontend-app-account20.46.320
frontend-app-admin-portal20.46.3136
frontend-app-authn20.46.25
frontend-app-communications20.46.26
frontend-app-course-authoring21.5.6102
frontend-app-discussions20.46.323
frontend-app-ecommerce20.46.23
frontend-app-enterprise-public-catalog20.46.35
frontend-app-gradebook20.45.09
frontend-app-learner-dashboard20.46.239
frontend-app-learner-portal-enterprise20.45.447
frontend-app-learner-portal-programs20.45.52
frontend-app-learner-record20.46.312
frontend-app-learning20.46.045
frontend-app-library-authoring21.5.629
frontend-app-ora-grading20.46.317
frontend-app-payment20.46.23
frontend-app-profile20.46.33
frontend-app-publisher20.46.31
frontend-app-support-tools20.46.035
frontend-component-header-edx21.5.66
frontend-component-header21.5.63
catalog-search20.45.05
frontend-learner-portal-base12.2.01
frontend-lib-content-components21.5.633
frontend-lib-special-exams20.44.023
frontend-platform21.5.61
prospectus20.46.247
studio-frontend3.4.814