IconButton
Leave feedbackBasic 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.
Props API#
- className
stringA custom class name.
- iconAs
elementTypeComponent that renders the icon, currently defaults to
FontAwesomeIcon, but is going to be deprecated soon, please use Paragon's icons instead. - src
element|funcDefaultnullAn icon component to render. Example import of a Paragon icon component:
import { Check } from '@edx/paragon/dist/icon'; - 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
boolDefaultfalseChanges icon styles for dark background
- icon
shape{prefix:string,iconName:string,icon:}array,Accepts a React fontawesome icon. https://fontawesome.com/how-to-use/on-the-web/using-with/react
- iconClassNames
stringExtra class names that will be added to the icon
- onClick
funcDefault() => {}Click handler for the button
- variant
enum'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand'Default'primary'Type of button (uses Bootstrap options)
- size
enum'sm' | 'md' | 'inline'Default'md'size of button to render
- isActive
boolDefaultfalsewhether to show the
IconButtonin an active state, whose styling is distinct from default state
- tooltipPlacement
stringDefault'top'tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options
- tooltipContent
nodeRequiredany valid JSX or text to be rendered as tooltip contents
- variant
enum'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand'Default'primary'Type of button (uses Bootstrap options)
- invertColors
boolDefaultfalseChanges icon styles for dark background
Usage Insights#
IconButton
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-admin-portal | 20.39.2 | 8 | |
| frontend-app-authn | 20.45.5 | 4 | |
| frontend-app-communications | 20.45.0 | 3 | |
| frontend-app-course-authoring | 20.35.1 | 7 | |
| frontend-app-discussions | 20.44.0 | 11 | |
| frontend-app-gradebook | 20.45.0 | 1 | |
| frontend-app-learner-dashboard | 20.32.0 | 2 | |
| frontend-app-learner-portal-enterprise | 20.45.1 | 1 | |
| frontend-app-learner-record | 20.45.0 | 1 | |
| frontend-app-learning | 20.28.4 | 5 | |
| frontend-app-library-authoring | 20.45.5 | 3 | |
| frontend-app-ora-grading | 20.45.1 | 5 | |
| frontend-app-support-tools | 20.45.0 | 2 | |
| frontend-component-header-edx | 20.45.5 | 1 | |
| frontend-component-header | 20.45.5 | 1 | |
| frontend-lib-content-components | 20.45.0 | 16 | |
| prospectus | 20.45.2 | 5 |
IconButtonWithTooltip
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-course-authoring | 20.35.1 | 3 | |
| frontend-app-support-tools | 20.45.0 | 1 | |
| frontend-lib-content-components | 20.45.0 | 6 |