Server Component · 0 KB client JS

Icon

A sizing and coloring wrapper for any icon set: Lucide, Heroicons, or your own SVGs.

Import#

import { Icon } from "astralis-ui";
import { Rocket } from "lucide-react"; // bring your own icons

Usage#

Astralis doesn't bundle an icon set: Icon normalizes whatever you use. Pass an icon component via as, or a raw <svg> as children; either way the wrapper controls size and color with tokens.

Sizes#

Token sizes xs–xl, or any explicit pixel number.

Colors#

Semantic text-color tokens, or omit color and the icon inherits the surrounding text color via currentColor, which is why button icons always match their label.

inherits via currentColor

Custom SVGs#

Props#

PropTypeDefaultDescription
asElementTypeNoneAn icon component to render, such as one from Lucide.
childrenReactNodeNoneOr a raw svg element, which fills the sized wrapper.
size"xs" | "sm" | "md" | "lg" | "xl" | number"md"A size token, or an explicit size in pixels.
colortext color token | CSS colorNoneOmit it and the icon inherits the surrounding text color through currentColor.
strokeWidthnumberNonePassed to icon components drawn with strokes. Has no effect on raw svg children.

Accessibility#

Icons are decorative by default (aria-hidden). When an icon stands alone as the only content of a control, label the control. See the icon-only pattern on the Button page.