IconButton
Basic Usage with Paragon Icon
Any Paragon component or export may be added to the code example.
With tooltips
Any Paragon component or export may be added to the code example.
Active State
Any Paragon component or export may be added to the code example.
isActive=true with inverted colors
Any Paragon component or export may be added to the code example.
Inverted Colors
Any Paragon component or export may be added to the code example.
Sizes
Any Paragon component or export may be added to the code example.
Theme Variables#
| CSS Variable | Computed Value |
|---|---|
| | |
| | |
| | |
| | |
| | |
Props API#
- iconAs
React.ComponentType<any>DefaultIconComponent that renders the icon, currently defaults to
Icon - className
stringAdditional CSS class[es] to apply to this button
- alt
stringRequiredAlt text for your icon. For best practice, avoid using alt text to describe the image in the
IconButton. Instead, we recommend describing the function of the button. - invertColors
booleanDefaultfalseChanges icon styles for dark background
- src
React.ComponentTypeAn icon component to render. Example import of a Paragon icon component:
import { Check } from '@openedx/paragon/icons'; - iconClassNames
stringExtra class names that will be added to the icon
- onClick
React.MouseEventHandler<HTMLButtonElement>Default() => {}Click handler for the button
- isActive
booleanDefaultfalseWhether to show the
IconButtonin an active state, whose styling is distinct from default state - icon
{ prefix?: string; iconName?: string, icon?: any[] } - variant
'primary'|'secondary'|'success'|'warning'|'danger'|'light'|'dark'|'black'|'brand'Default'primary'Type of button (uses Bootstrap options).
- size
'sm'|'md'|'inline'Default'md'Size of button to render
- children
neverNo children
- iconAs
React.ComponentType<any>Component that renders the icon, currently defaults to
Icon - className
stringAdditional CSS class[es] to apply to this button
- alt
stringRequiredAlt text for your icon. For best practice, avoid using alt text to describe the image in the
IconButton. Instead, we recommend describing the function of the button. - invertColors
booleanChanges icon styles for dark background
- src
React.ComponentTypeAn icon component to render. Example import of a Paragon icon component:
import { Check } from '@openedx/paragon/icons'; - iconClassNames
stringExtra class names that will be added to the icon
- onClick
React.MouseEventHandler<HTMLButtonElement>Click handler for the button
- isActive
booleanWhether to show the
IconButtonin an active state, whose styling is distinct from default state - icon
{ prefix?: string; iconName?: string, icon?: any[] } - variant
'primary'|'secondary'|'success'|'warning'|'danger'|'light'|'dark'|'black'|'brand'Type of button (uses Bootstrap options).
- size
'sm'|'md'|'inline'Size of button to render
- children
neverNo children
- tooltipPlacement
PlacementDefault'top'Tooltip placement can be top, left, right etc, choose from https://popper.js.org/docs/v2/constructors/#options
- tooltipContent
React.ReactNodeRequiredAny content to pass to tooltip content area
Usage Insights#
IconButton
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-admin-portal | 22.20.3 | 16 | |
| frontend-app-communications | 23.14.2 | 3 | |
| frontend-app-course-authoring | 23.15.1 | 35 | |
| frontend-app-discussions | 23.14.2 | 12 | |
| frontend-app-enterprise-public-catalog | 22.20.5 | 2 | |
| frontend-app-gradebook | 23.4.5 | 1 | |
| frontend-app-discussions | 23.14.9 | 1 | |
| frontend-app-learner-portal-enterprise | 22.17.0 | 5 | |
| frontend-app-learner-record | 23.14.9 | 1 | |
| frontend-app-gradebook | 23.4.5 | 6 | |
| frontend-app-learner-record | 23.4.5 | 5 | |
| frontend-app-profile | 23.14.9 | 1 | |
| frontend-app-publisher | 23.14.8 | 1 | |
| frontend-app-support-tools | 23.4.2 | 3 | |
| frontend-component-header | 23.15.0 | 1 |
IconButtonWithTooltip
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-admin-portal | 22.20.3 | 112 | |
| frontend-app-authn | 23.14.0 | 5 | |
| frontend-app-course-authoring | 23.15.1 | 29 | |
| frontend-app-discussions | 23.14.2 | 1 | |
| frontend-app-learner-portal-enterprise | 22.17.0 | 9 | |
| frontend-app-support-tools | 23.4.2 | 2 |