We also provide CommonJS and UMD files in the lib and umd directories,
respectively.
To import using CommonJS, you can do the following:
const { Add } = require('@carbon/icons-react');
Note: if you would like to find the import path for an icon, you can reference
our
Icon Library
Icon fill
All icons from the library support being styled by the fill property. You can
change the color of an icon by passing in a custom class name that sets this
property (preferred), or by passing in an inline style. For example:
// CSS custom class name to set the fill of the iconto `rebeccapurple`
svg.my-custom-class {
fill: rebeccapurple;
}
Certain icons in the library support two distinct fill colors. You can target
the inner path by using the [data-icon-path="inner-path"] attribute selector.
For example:
// CSS custom class name to set the fill of the icon to `yellow`
svg.my-custom-class {
fill: yellow;
}
// Use the `data-icon-path` attribute selector to target the inner path// where we want to set the fill to `black`. We also set `opacity` to `1` so// that this inner-path is visible.
svg.my-custom-class[data-icon-path='inner-path'] {
fill: black;
opacity: 1;
}
By default, the icon components from @carbon/icons-react are treated as
decorative content. This means that we set aria-hidden="true" unless certain
props are passed to the component.
If you would like the icon to be announced by a screen reader, you can supply an
aria-label or aria-labelledby. For example:
Including tabIndex and aria-label (or aria-labelledby) will set the
corresponding tabindex on the underlying <svg> and verify support in older
browsers like Internet Explorer 11 by setting focusable to true.
🙌 Contributing
We're always looking for contributors to help us fix bugs, build new features,
or help us improve the project documentation. If you're interested, definitely
check out our Contributing Guide! 👀
This package uses IBM Telemetry to collect metrics data. By installing this
package as a dependency you are agreeing to telemetry collection. To opt out,
see
Opting out of IBM Telemetry data collection.
For more information on the data being collected, please see the
IBM Telemetry documentation.
React components for icons in digital and software products using the Carbon Design System
The npm package @carbon/icons-react receives a total of 104,820 weekly downloads. As such, @carbon/icons-react popularity was classified as popular.
We found that @carbon/icons-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 14 open source maintainers collaborating on the project.
Last updated on 27 Mar 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.