Home / Function/ getIconElement() — astro Function Reference

getIconElement() — astro Function Reference

Architecture documentation for the getIconElement() function in icons.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  f0709203_1895_a9f3_40fe_73365ce2b7aa["getIconElement()"]
  f036ce04_951c_36f1_9ff9_f02cf348b66e["icons.ts"]
  f0709203_1895_a9f3_40fe_73365ce2b7aa -->|defined in| f036ce04_951c_36f1_9ff9_f02cf348b66e
  style f0709203_1895_a9f3_40fe_73365ce2b7aa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts lines 10–23

export function getIconElement(
	name: DefinedIcon | (string & NonNullable<unknown>),
): SVGElement | undefined {
	const icon = icons[name as DefinedIcon];

	if (!icon) {
		return undefined;
	}

	const svgFragment = new DocumentFragment();
	svgFragment.append(document.createRange().createContextualFragment(icon));

	return svgFragment.firstElementChild as SVGElement;
}

Domain

Subdomains

Frequently Asked Questions

What does getIconElement() do?
getIconElement() is a function in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts.
Where is getIconElement() defined?
getIconElement() is defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts at line 10.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free