Custom HTML elements
You can always create your own custom HTML elements and then use them alongside built-in ones, e.g.:
You can read more about this in this person’s blog post.
Basic usageSection titled Basic usage
Here’s a simple component that extends
Then, to use the new
astro-greet element, you could do something like this:
How Section titled How querySelector works
Suppose you have this:
AstroGreet can find its own local button with
this.querySelector("#test"). However, in the resulting HTML, both buttons will have exactly the same ID.