Function: Icon()
Icon(
nameOrOptions?:string| {align?:Align;blur?:number;brightness?:number;className?:string;color?:string;customPositioned?:boolean;enterDelay?:number;enterDuration?:number;exitDelay?:number;exitDuration?:number;height?:Size;id?:string;name?:string;onActivate?: () =>void;onDeactivate?: () =>void;onMount?: () =>void;onUnmount?: () =>void;opacity?:number;origin?:ElementAnchor;position?:Position;rotation?:number;scale?:number;size?:Size;style?:Properties<0|string&object,string&object>;theme?:Partial<ThemeConfig>;width?:Size;x?:PositionCoord;y?:PositionCoord; },maybeOptions?:object):IconElement
Creates a reactive Icon element on stage.
Parameters
| Parameter | Type | Description |
|---|---|---|
nameOrOptions | string | { align?: Align; blur?: number; brightness?: number; className?: string; color?: string; customPositioned?: boolean; enterDelay?: number; enterDuration?: number; exitDelay?: number; exitDuration?: number; height?: Size; id?: string; name?: string; onActivate?: () => void; onDeactivate?: () => void; onMount?: () => void; onUnmount?: () => void; opacity?: number; origin?: ElementAnchor; position?: Position; rotation?: number; scale?: number; size?: Size; style?: Properties<0 | string & object, string & object>; theme?: Partial<ThemeConfig>; width?: Size; x?: PositionCoord; y?: PositionCoord; } | - |
maybeOptions | { align?: Align; blur?: number; brightness?: number; className?: string; color?: string; customPositioned?: boolean; enterDelay?: number; enterDuration?: number; exitDelay?: number; exitDuration?: number; height?: Size; id?: string; name?: string; onActivate?: () => void; onDeactivate?: () => void; onMount?: () => void; onUnmount?: () => void; opacity?: number; origin?: ElementAnchor; position?: Position; rotation?: number; scale?: number; size?: Size; style?: Properties<0 | string & object, string & object>; theme?: Partial<ThemeConfig>; width?: Size; x?: PositionCoord; y?: PositionCoord; } | - |
maybeOptions.align? | Align | - |
maybeOptions.blur? | number | Blur in virtual pixels (default: 0). |
maybeOptions.brightness? | number | Brightness multiplier (default: 1). |
maybeOptions.className? | string | - |
maybeOptions.color? | string | Foreground CSS color (default: component/theme color). |
maybeOptions.customPositioned? | boolean | Whether this element manages its own CSS transform / positioning (disables stage translate3d). |
maybeOptions.enterDelay? | number | Delay in seconds before entering scene transition begins. |
maybeOptions.enterDuration? | number | Duration in seconds for entering scene transition. |
maybeOptions.exitDelay? | number | Delay in seconds before exiting scene transition begins. |
maybeOptions.exitDuration? | number | Duration in seconds for exiting scene transition. |
maybeOptions.height? | Size | Height in stage units or CSS length (default: content size). |
maybeOptions.id? | string | - |
maybeOptions.name? | string | Icon identifier (e.g. "lucide:heart", "mycompany:logo") or raw SVG markup. |
maybeOptions.onActivate? | () => void | - |
maybeOptions.onDeactivate? | () => void | - |
maybeOptions.onMount? | () => void | - |
maybeOptions.onUnmount? | () => void | - |
maybeOptions.opacity? | number | Whole-element opacity from 0 to 1 (default: 1). |
maybeOptions.origin? | ElementAnchor | Which point of the element sits on its coordinate (default: "top-left"). |
maybeOptions.position? | Position | - |
maybeOptions.rotation? | number | Rotation in degrees (default: 0). |
maybeOptions.scale? | number | Scale multiplier (default: 1). |
maybeOptions.size? | Size | Both dimensions in stage units or CSS length (default: unset). |
maybeOptions.style? | Properties<0 | string & object, string & object> | - |
maybeOptions.theme? | Partial<ThemeConfig> | - |
maybeOptions.width? | Size | Width in stage units or CSS length (default: content size). |
maybeOptions.x? | PositionCoord | Horizontal position in stage units (default: 0). |
maybeOptions.y? | PositionCoord | Vertical position in stage units (default: 0). |
Returns
Example
const heart = Icon("lucide:heart", {
x: "center",
y: 40,
size: 48,
color: "#f43f5e",
});