Hopper provides multiple ways to use icons in your project:
- Using the Workleap icon library
- Creating your own icons
Creating your custom icons
To use an icon component to create custom icons you must first import your SVG icon as a component by using @svgr/webpack
.
Hopper provides two methods for creating your custom icons:
- Using the
createIcon
function (recommended) - Using the
Icon
component
Both Icon
and createIcon
enable you to style the icon using the styled system.
Using the createIcon function
The createIcon
function is a convenience wrapper around the process of generating icons with Icon
, allowing you to achieve the same functionality with less effort.
Using the Icon component
Usage
Sizes
An icon can vary in size. When used inside another component, it'll generally be sized automatically. If you use a standalone icon, you can use the size prop to control the sizing.
Styling
The color of the icon can be changed using the fill
prop. All the styled system props are also available.
Props
- style?
- className?
- id?
- size?
- src16
- src24
- src32
The size of the icon.
The source of the icon with a size of 16px.
The source of the icon with a size of 24px.
The source of the icon with a size of 32px.
- slot?
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null
value indicates that the local props completely override all props received from a parent.