-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make astro-icon
usable from UI framework components
#151
Comments
Correct me if I'm mistaken, but I believe you can actually do that already, Astro allows the usage of Astro components in UI framework components through named slots. The example in the docs uses a <MyReactComponentOrWhateverFramework>
<Icon name='mdi:home' slot='icon' />
</MyReactComponentOrWhateverFramework> Just ensure you have a slot inside your component named |
@iivvaannxx I think that would work, but turn out to be very impractical for an interactive website. Since Astro components can't be included from framework components, all re-usable components tend to be framework components. Only the root level pages are Astro components. That means that all |
@PeterDraex Yeah, in that situation it's true that is a bit of a pain to do so. Then I guess that this library may not be your best option for your use case. You could take a look at You lose indeed many of the features that this library offers for Astro icons but if you're using it only for icons then Also, it seems this library is receiving less and less updates so if you have any ideas, I would recommend going to this proposal which talks about Astro native Icon support. |
Currently, it is not possible to call Astro components from UI frameworks, so it is currently not possible to use
astro-icon
on interactive websites. The issue is thatastro-icon
only exports Astro components, which cannot be used from within UI frameworks.I see two approaches to fix this:
<Sprite>
component in their app.This is currently not possible, because the package exports are limited to:
Which would need to be changed to:
<Sprite>
To do this, we would:
Sprite.astro
toSprite.jsx
(Sprite.astro
would just receive props and pass it toSprite.jsx
)However, I guess this would not work for non-JSX UI frameworks (e.g. Svelte).
What do you think? Would a PR for either of these solutions be accepted?
The text was updated successfully, but these errors were encountered: