Home / Function/ updateStyle() — astro Function Reference

updateStyle() — astro Function Reference

Architecture documentation for the updateStyle() function in button.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  c0bc2133_c99b_6451_e7a8_d102fd27fb18["updateStyle()"]
  0be0f13c_4e4c_ecbe_a0e3_b8c2434de94f["DevToolbarButton"]
  c0bc2133_c99b_6451_e7a8_d102fd27fb18 -->|defined in| 0be0f13c_4e4c_ecbe_a0e3_b8c2434de94f
  9aaefa24_cc9a_798a_ebb6_230263c2d07d["size()"]
  9aaefa24_cc9a_798a_ebb6_230263c2d07d -->|calls| c0bc2133_c99b_6451_e7a8_d102fd27fb18
  958a9319_cdd9_512f_c5a9_b1ebb372d980["buttonStyle()"]
  958a9319_cdd9_512f_c5a9_b1ebb372d980 -->|calls| c0bc2133_c99b_6451_e7a8_d102fd27fb18
  7e38b273_bee0_b291_7c84_d1dd9205ec13["buttonBorderRadius()"]
  7e38b273_bee0_b291_7c84_d1dd9205ec13 -->|calls| c0bc2133_c99b_6451_e7a8_d102fd27fb18
  535a1f50_cd0a_bbe5_529e_7186b9a9a27c["connectedCallback()"]
  535a1f50_cd0a_bbe5_529e_7186b9a9a27c -->|calls| c0bc2133_c99b_6451_e7a8_d102fd27fb18
  style c0bc2133_c99b_6451_e7a8_d102fd27fb18 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

	updateStyle() {
		const style = this.shadowRoot.querySelector<HTMLStyleElement>('#selected-style');

		if (style) {
			style.innerHTML = `
			button {
				--background: var(--${this.buttonStyle}-background);
				--border: var(--${this.buttonStyle}-border);
				--font-size: var(--${this.size}-font-size);
				--text-color: var(--${this.buttonStyle}-text);
				${
					this.buttonBorderRadius === 'normal'
						? '--padding: var(--' + this.size + '-padding);'
						: '--padding: var(--' + this.size + '-rounded-padding);'
				}
				--border-radius: var(--${this.buttonBorderRadius}-border-radius);
			}`;
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does updateStyle() do?
updateStyle() is a function in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts.
Where is updateStyle() defined?
updateStyle() is defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts at line 153.
What calls updateStyle()?
updateStyle() is called by 4 function(s): buttonBorderRadius, buttonStyle, connectedCallback, size.

Analyze Your Own Codebase

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

Try Supermodel Free