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
string
Additional CSS class[es] to apply to this button
- alt
string
RequiredAlt 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
boolean
DefaultfalseChanges icon styles for dark background
- src
React.ComponentType
An icon component to render. Example import of a Paragon icon component:
import { Check } from '@openedx/paragon/icons';
- iconClassNames
string
Extra class names that will be added to the icon
- onClick
React.MouseEventHandler<HTMLButtonElement>
Default() => {}Click handler for the button
- isActive
boolean
DefaultfalseWhether to show the
IconButton
in 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
never
No children
- iconAs
React.ComponentType<any>
Component that renders the icon, currently defaults to
Icon
- className
string
Additional CSS class[es] to apply to this button
- alt
string
RequiredAlt 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
boolean
Changes icon styles for dark background
- src
React.ComponentType
An icon component to render. Example import of a Paragon icon component:
import { Check } from '@openedx/paragon/icons';
- iconClassNames
string
Extra class names that will be added to the icon
- onClick
React.MouseEventHandler<HTMLButtonElement>
Click handler for the button
- isActive
boolean
Whether to show the
IconButton
in 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
never
No children
- tooltipPlacement
Placement
Default'top'Tooltip placement can be top, left, right etc, choose from https://popper.js.org/docs/v2/constructors/#options
- tooltipContent
React.ReactNode
RequiredAny content to pass to tooltip content area
Usage Insights#
IconButton
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 14 | |
frontend-app-authn | 22.11.2 | 4 | |
frontend-app-communications | 22.7.0 | 3 | |
frontend-app-course-authoring | 22.8.1 | 38 | |
frontend-app-discussions | 22.7.0 | 12 | |
frontend-app-enterprise-public-catalog | 21.13.1 | 2 | |
frontend-app-gradebook | 22.8.1 | 1 | |
frontend-app-learner-dashboard | 22.9.0 | 1 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 5 | |
frontend-app-learner-record | 22.10.0 | 1 | |
frontend-app-learning | 22.10.0 | 8 | |
frontend-app-library-authoring | 21.11.3 | 4 | |
frontend-app-ora-grading | 21.11.3 | 5 | |
frontend-app-support-tools | 21.13.1 | 3 | |
frontend-component-header-edx | 21.13.1 | 2 | |
frontend-component-header | 22.10.0 | 1 | |
prospectus | 20.46.2 | 7 |
IconButtonWithTooltip
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 5 | |
frontend-app-course-authoring | 22.8.1 | 29 | |
frontend-app-discussions | 22.7.0 | 1 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 2 | |
frontend-app-library-authoring | 21.11.3 | 1 | |
frontend-app-support-tools | 21.13.1 | 2 |