Home / Function/ constructor() — astro Function Reference

constructor() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1495abd0_bbea_7d52_43a3_6536e47cb235["constructor()"]
  0be0f13c_4e4c_ecbe_a0e3_b8c2434de94f["DevToolbarButton"]
  1495abd0_bbea_7d52_43a3_6536e47cb235 -->|defined in| 0be0f13c_4e4c_ecbe_a0e3_b8c2434de94f
  style 1495abd0_bbea_7d52_43a3_6536e47cb235 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

	constructor() {
		super();
		this.shadowRoot = this.attachShadow({ mode: 'open' });

		this.shadowRoot.innerHTML = `
			<style>
				button {
					--purple-background: rgba(113, 24, 226, 1);
					--purple-border: rgba(224, 204, 250, 0.33);
					--purple-text: #fff;

					--gray-background: rgba(52, 56, 65, 1);
					--gray-border: rgba(71, 78, 94, 1);
					--gray-text: #fff;

					--red-background: rgba(179, 62, 102, 1);
					--red-border: rgba(249, 196, 215, 0.33);
					--red-text: #fff;

					--green-background: rgba(213, 249, 196, 1);
					--green-border: rgba(61, 125, 31, 1);
					--green-text: #000;

					--yellow-background: rgba(255, 236, 179, 1);
					--yellow-border: rgba(255, 191, 0, 1);
					--yellow-text: #000;

					--blue-background: rgba(54, 69, 217, 1);
					--blue-border: rgba(189, 195, 255, 1);
					--blue-text: #fff;

					--outline-background: transparent;
					--outline-border: #fff;
					--outline-text: #fff;

					--ghost-background: transparent;
					--ghost-border: transparent;
					--ghost-text: #fff;

					--large-font-size: 16px;
					--medium-font-size: 14px;
					--small-font-size: 12px;

					--large-padding: 12px 16px;
					--large-rounded-padding: 12px 12px;
					--medium-padding: 8px 12px;
					--medium-rounded-padding: 8px 8px;
					--small-padding: 4px 8px;
					--small-rounded-padding: 4px 4px;

					--normal-border-radius: 4px;
					--rounded-border-radius: 9999px;

					border: 1px solid var(--border);
					padding: var(--padding);
					font-size: var(--font-size);
					background: var(--background);

					color: var(--text-color);
					border-radius: var(--border-radius);
					display: flex;
					align-items: center;
					justify-content: center;
				}

				button:hover {
					cursor: pointer;
				}

				::slotted(astro-dev-toolbar-icon) {
					display: inline-block;
					height: 1em;
					width: 1em;
					margin-left: 0.5em;
				}
			</style>
			<style id="selected-style"></style>

			<button>
				<slot></slot>
			</button>

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free