addDevToolbarFrameworkApp allows you to register a framework component as a Dev Toolbar App!
You can now use a React, Preact, Solid, Vue or Svelte component instead of manipulating the DOM imperatively!
Component Props
addDevToolbarFrameworkApp initialises your framework component with three props:
canvas
Type:HTMLElement
The root ShadowDOM node that holds your whole application.
It’s recommended to manually add the official Astro integration for your chosen framework
using the addIntegration utility instead of relying on your users
to install and add it. addIntegration won’t re-add integrations, so you’re safe to call it even
if your user has added it already.
addIntegrationThe addIntegration is used to add integrations from an integration.
This also means it’s a good idea to have the @astrojs/* framework package be a dependency of your
integration package so the correct dependencies will definitely be installed.
Styling
addDevToolbarFrameworkApp allows you to pass in a stylesheet through the option style.
This stylesheet gets injected into the shadow DOM of your plugin meaning it’s styles won’t leak out.
This is great so you don’t have to define your styles in your component or JS. You can create a stylesheet and use that as the styles for your app.
Tailwind CSS
Tailwind is not supported out of the box… Yet! 👀
As in you can’t just use Tailwind classes in your component and it’ll work. Even if you
install the @astrojs/tailwind integration. The Tailwind integration currently has no way
to attach styles generated to the shadow DOM of your plugin.
If you want to use Tailwind, your best option is to build the stylesheet yourself and read
the file in your component.
Then you can run the Tailwind CLI and it will generate a CSS file for you.