#Import astro component in svelte component
3 messages · Page 1 of 1 (latest)
Hi @reef basalt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
No, you cannot directly import .astro components in a .svelte component. According to the Astro documentation (https://docs.astro.build/en/guides/framework-components/#can-i-use-astro-components-inside-my-framework-components), any UI framework component becomes an “island” of that framework. These components must be written entirely as valid code for that framework, using only its own imports and packages.
However, you can use the Astro <slot /> pattern to pass static content generated by Astro components as children to your framework components inside an .astro component. Here's an example:
---import MyReactComponent from '../components/MyReactComponent.jsx';import MyAstroComponent from '../components/MyAstroComponent.astro';---<MyReactComponent> <MyAstroComponent slot="name" /></MyReactComponent>