Medusa UI React icon library with 388 auto-generated SVG icon components for consistent iconography in React applications
npx @tessl/cli install tessl/npm-medusajs--icons@2.10.0@medusajs/icons is a comprehensive React icon library containing 388 auto-generated SVG icon components used in Medusa's design system. The icons are automatically generated from Figma designs using @medusajs/toolbox and provide a consistent, type-safe interface for incorporating scalable vector icons into React applications.
npm install @medusajs/iconsimport { Check, ArrowRight, User } from "@medusajs/icons";For CommonJS:
const { Check, ArrowRight, User } = require("@medusajs/icons");import { Check, ArrowRight, User } from "@medusajs/icons";
function MyComponent() {
return (
<div>
{/* Basic usage with default styling */}
<Check />
<ArrowRight />
<User />
{/* Custom color */}
<Check color="red" />
<ArrowRight color="#3b82f6" />
{/* With standard SVG attributes */}
<User className="icon-large" onClick={() => console.log('clicked')} />
{/* All icons use currentColor by default for theme integration */}
<div style={{ color: 'blue' }}>
<Check /> {/* Will be blue */}
</div>
</div>
);
}@medusajs/icons is built with the following design principles:
All 388 icon components are React.forwardRef components that render inline SVG elements with consistent styling and behavior.
/**
* Icon component type - all icons follow this pattern
*/
type IconComponent = React.ForwardRefExoticComponent<
IconProps & React.RefAttributes<SVGSVGElement>
>;
/**
* Props interface for all icon components
*/
interface IconProps extends React.SVGAttributes<SVGElement> {
/** Prevents children (icons are self-contained) */
children?: never;
/** Custom color override (defaults to "currentColor") */
color?: string;
}The library contains 388 icon components organized by functional categories:
// Navigation icons
const ArrowRight: IconComponent;
const ArrowLeft: IconComponent;
const ChevronDown: IconComponent;
const Check: IconComponent;
// User interface icons
const User: IconComponent;
const Users: IconComponent;
const Cog: IconComponent;
const Settings: IconComponent;
// Business icons
const ShoppingCart: IconComponent;
const CreditCard: IconComponent;
const Buildings: IconComponent;
// Brand icons
const Github: IconComponent;
const Stripe: IconComponent;
const ReactJs: IconComponent;Theme Integration:
// Icons inherit text color by default
<div className="text-blue-500">
<Check /> {/* Will be blue */}
</div>
// Override with custom colors
<ArrowRight color="#ef4444" />
<User color="var(--primary-color)" />Event Handling:
// Icons support all standard SVG event handlers
<Trash
onClick={() => handleDelete()}
onMouseEnter={() => setHovered(true)}
className="cursor-pointer hover:text-red-500"
/>Refs and DOM Access:
const iconRef = useRef<SVGSVGElement>(null);
return <Check ref={iconRef} />;Type Inference (since IconProps is not directly exported):
// Infer icon prop types from existing components
type CheckProps = React.ComponentProps<typeof Check>;
type IconRefType = React.ComponentRef<typeof Check>;
// Use in your own components
interface MyComponentProps {
iconProps: CheckProps;
}Accessibility:
// Add accessibility attributes
<User
role="img"
aria-label="User profile"
tabIndex={0}
/>import * as React from "react";
/**
* Props interface for all icon components (not directly exported)
* Extends React.SVGAttributes<SVGElement> for full SVG compatibility
* This interface can be inferred from component props: React.ComponentProps<typeof Check>
*/
interface IconProps extends React.SVGAttributes<SVGElement> {
/** Prevents children - icons are self-contained SVG elements */
children?: never;
/** Custom color override (defaults to "currentColor" for theme integration) */
color?: string;
}
/**
* All icon components follow this type pattern
* Forward-referenced React components rendering SVGSVGElement
*/
type IconComponent = React.ForwardRefExoticComponent<
IconProps & React.RefAttributes<SVGSVGElement>
>;Icon components are designed to be robust:
Common error scenarios and their behavior:
// These all work as expected
<Check color="invalid-color" /> // SVG handles invalid colors gracefully
<ArrowRight someCustomProp="value" /> // Passed through to SVG
<User ref={null} /> // Handles null refs safely