Home / Function/ getElementForIcon() — astro Function Reference

getElementForIcon() — astro Function Reference

Architecture documentation for the getElementForIcon() function in tooltip.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  453c295d_f19e_ede7_56f2_06b896195e71["getElementForIcon()"]
  02d34ec7_b0ee_fa04_4dfa_7cac0d8acf80["DevToolbarTooltip"]
  453c295d_f19e_ede7_56f2_06b896195e71 -->|defined in| 02d34ec7_b0ee_fa04_4dfa_7cac0d8acf80
  17f05048_4f89_66a0_e35b_11d9f74cb863["connectedCallback()"]
  17f05048_4f89_66a0_e35b_11d9f74cb863 -->|calls| 453c295d_f19e_ede7_56f2_06b896195e71
  style 453c295d_f19e_ede7_56f2_06b896195e71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/client/dev-toolbar/ui-library/tooltip.ts lines 157–171

	getElementForIcon(icon: Icon | (string & NonNullable<unknown>)) {
		let iconElement;
		if (isDefinedIcon(icon)) {
			iconElement = getIconElement(icon);
		} else {
			iconElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
			iconElement.setAttribute('viewBox', '0 0 16 16');
			iconElement.innerHTML = icon;
		}

		iconElement?.style.setProperty('width', '16px');
		iconElement?.style.setProperty('height', '16px');

		return iconElement?.outerHTML ?? '';
	}

Domain

Subdomains

Frequently Asked Questions

What does getElementForIcon() do?
getElementForIcon() is a function in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/tooltip.ts.
Where is getElementForIcon() defined?
getElementForIcon() is defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/tooltip.ts at line 157.
What calls getElementForIcon()?
getElementForIcon() is called by 1 function(s): connectedCallback.

Analyze Your Own Codebase

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

Try Supermodel Free