We use cookies to ensure you get the best experience on our website. Read our privacy policy

Skip to main content

Directory

Icon Component

The Icon component provides a consistent way to display SVG icons throughout your application. With built-in size variants and hover effects, you can easily integrate icons that match your design system.

  • Check Circle

    Multiple Sizes: Pre-defined size variants from small to extra-large

  • Check Circle

    Hover Effects: Optional hover states for interactive icons

  • Check Circle

    Flexible Integration: Works with any SVG content

  • Check Circle

    Responsive Design: Automatic scaling and fitting options

The Icon component accepts SVG content through the svg prop:

---
import importedSvg from '@/assets/icons/example.svg?raw';
---
<Icon svg={importedSvg} />

The Icon component comes with predefined size variants:

Check Circle Check Circle Check Circle Check Circle Check Circle
<Icon svg={mySvg} size="sm" /> <!-- 16x16 pixels -->
<Icon svg={mySvg} size="md" /> <!-- 20x20 pixels -->
<Icon svg={mySvg} size="default" /> <!-- 24x24 pixels -->
<Icon svg={mySvg} size="lg" /> <!-- 32x32 pixels -->
<Icon svg={mySvg} size="xl" /> <!-- 48x48 pixels -->
<Icon svg={mySvg} size="fit" /> <!-- Fits container -->

Add hover effects to make icons interactive:

Check Circle Check Circle
<Icon svg={mySvg} variant="default" /> <!-- Static icon -->
<Icon svg={mySvg} variant="hover" /> <!-- Hover effect -->
Icon Component Props Extends <div> HTMLElement
Prop Type Default Description
svg string - SVG content to display
size sm | md | default | lg | xl | fit default Icon size variant
variant default | hover default Visual style variant
class string - Additional CSS classes
  1. SVG Optimization

    • Optimize SVGs before use
    • Remove unnecessary attributes
    • Use consistent viewBox sizes
    • Minimize path complexity
  2. Accessibility

    • Include aria-label when icon conveys meaning
    • Use role=“img” for decorative icons
    • Ensure sufficient color contrast
    • Consider icon recognition

Limited Time Launch Sale

Add beautiful, responsive icons to your project with our Icon component. Get started with our AstroJS starter template today!

GET 60% OFF!
North Star Themes Logo

Subscribe to our newsletter

Get the latest AstroJS tips and tricks right to your inbox

Email: [email protected]

© 2025 North Star Themes

Web Kit Provided By North Star Themes