Code
import { Icon, IconsProvider } from '@lmc-eu/spirit-web-react/components';
import icons from '@lmc-eu/spirit-icons/icons';<
...
<IconsProvider value={icons}>
<Icon name="warning" />
Hey! Pay attention!
</IconsProvider>
Storybook
Usage
Icon
Icons are graphical metaphors or symbols that can be used to complement existing experiences.
🚀 Getting started
To use this component in your project you need to run the following command using npm:
npm install -S @lmc-eu/spirit-icons
If you prefer Yarn, use the following command instead:
yarn add @lmc-eu/spirit-icons
📦 Dependencies
@lmc-eu/spirit-icons is required as a peer dependency to keep package size as low as possible. So it will not be automatically installed with @lmc-eu/spirit-web-react.
- @lmc-eu/spirit-icons - Spirit Icons package
- html-react-parser - HTML to React parser (avoid usage of dangerouslySetInnerHTML on the server side)
📝 Usage
import { Icon, IconsProvider } from '@lmc-eu/spirit-web-react/components';
import icons from '@lmc-eu/spirit-icons/icons';
<IconsProvider value={icons}>
<Icon name="warning" />
Hey! Pay attention!
</IconsProvider>
🧩 API
Name | Type | Default | Required | Description |
---|---|---|---|---|
boxSize | number | 24 | ✕ | Size of the icon |
name | string | — | ✔ | Name of the icon |
title | string | — | ✕ | Title of the icon |
On top of the API options, the components accept additional attributes. If you need more control over the styling of a component, you can use style props and escape hatches.
For more details about Icons see Spirit Icons package.