#How to select custom/imported component?
8 messages · Page 1 of 1 (latest)
you could always make a prop on <Option class="your classes"
and then use that string to inject in your component
dosent work
Just says null when i try to read it
how are you using the class / prop in Svelte?
Because it might be easier to make an Option.astro which is a wrapper with a <slot /> that defines the style and then slot your Svelte component in there
Sorry, I dont understand what you mean. This is what my code looks like:
---
import MainPage from "../layouts/MainPage.astro";
import Option from "../layouts/Option.svelte";
---
<MainPage title="Index">
<div class="option-list inset-x-0 bottom-0 absolute text-white flex mb-16 mx-5 items-center text-center justify-center text-xl">
<div>
<Option client:idle>foo <b>bar</b></Option>
<Option client:idle>bar <b>foo</b></Option>
<Option client:idle>spam <b>egg</b></Option>
<Option client:idle><b>foobar</b></Option>
</div>
</div>
</MainPage>
I basically want to display different html depending on what button is clicked
How do I add a separate click event listener to each Option component? They are svelte components. I want to display different html depending on which Option component is clicked.