heroicons icon indicating copy to clipboard operation
heroicons copied to clipboard

Add typescript note to README

Open danieltott opened this issue 2 years ago • 2 comments

Based on this comment - I was thinking passing an Icon prop might be common enough to warrant a note in the README.

danieltott avatar Jun 03 '22 14:06 danieltott

This hint proved useful for me today!

We use a shared component library at my job, and previously all Hero Icons were being imported so we could use an icon component as e.g. <Icon name="ArchiveIcon">. This broke tree-shaking though as all icons needed to be bundled with the <Icon> component. Your solution with e.g. <Icon icon={<ArchiveIcon>}> is a fantastic workaround for us to apply universal styling with something resembling an HOC.

rmcauley avatar Jun 27 '22 14:06 rmcauley

Make sense to get implement this small piece since it will be useful for many people.

paabloLC avatar Aug 03 '22 06:08 paabloLC

If you are using Vite, you can import svg directly from package.

import { ExclamationCircleIcon } from '@heroicons/react/20/solid/'

kpostekk avatar Aug 24 '22 21:08 kpostekk

Hey! For now just going to let people who need this info find it via these existing discussions about it online 👍 Thanks though.

adamwathan avatar Sep 09 '22 10:09 adamwathan