Skip to content
Gravity Logo / Docs Gravity home
Browse documentation
Documentation/Gravity Web

Icon

The Icon component renders an icon from Lucide React. Icons are lazy-loaded to prevent increasing bundle size.

Usage

import { Icon } from 'components/lib';

function MyComponent({ ...props }){
  return (
    <div>
      <Icon name='alert-circle' size={ 16 } color='red' />
      <Icon name='check' size={ 24 } color='#10b981' />
    </div>
  );
}

Props

PropDescriptionRequiredValue
classNamecustom stylesoptionalSCSS or Tailwind
coloricon outline coloroptionalstring (light/dark/green/blue/orange/red) default: dark
nameicon namerequiredstring (see Lucide Icons)
sizeicon sizerequiredinteger, default: 16

Notes

  • The Icon component uses lazy, Suspense, and useMemo from React to handle lazy loading of icons.
  • The name prop specifies the icon image to use and converts it to PascalCase if necessary.
  • The color and fill props allow for customizing the outline and fill colors of the icon.
  • Icons are loaded from the lucide-react library.