ba09750661
* Rename stories * MDX guidelines * dedupe and fix dependencies * Notice Banner Docs * Fix root elements and icon library docs * Fix ProductPrice stories * Organise storybook structure * Fix error placeholder story * Snackbar docs * Missing dotenv dependency * Update storybook/main.js Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/notice-banner/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update assets/js/base/components/snackbar-list/docs/docs.mdx Co-authored-by: Alex Florisca <alex.florisca@automattic.com> * Update package lock * update snaps * fix json error check --------- Co-authored-by: Alex Florisca <alex.florisca@automattic.com> |
||
---|---|---|
.. | ||
docs | ||
library | ||
README.md | ||
index.js |
README.md
Icons
Table of contents
WooCommerce Blocks Icons Library.
Usage
Note we use the Icon
component from @wordpress/icons
. We use some SVG icons from @woocommerce/icons
for WC Blocks specific icons, but we also use existing icons from @wordpress/icons
.
import { woo } from '@woocommerce/icons';
import { Icon, postComments } from '@wordpress/icons';
<Icon icon={ woo } /> // icon from '@woocommerce/icons'
<Icon icon={ postComments } /> // icon from '@wordpress/icons'
<Icon icon={ woo } size={ 16 } />
<Icon icon={ woo } width={ 20 } height={ Math.floor( 20 * 1.67 ) } />
Adding Icons
Before adding a new icon, make sure the icon is not already included in the Library that comes with @wordpress/icons package. If there is no existing icon suitable:
- Add the icon file to
./library
folder. - Make sure to use
SVG
primitive from@wordpress/primitives
and not a native svg.SVG
offers more accessibility features. - Remove width and height since they're handled by Icon.
- Remove any hardcoded colors on the svg. If necessary, use
CurrentColor
. - Export the Icon in
./library/index.js
.
We're hiring! Come work with us!
🐞 Found a mistake, or have a suggestion? Leave feedback about this document here.