- From: Keith Cirkel <notifications@github.com>
- Date: Wed, 08 Mar 2023 07:18:09 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 8 March 2023 15:18:22 UTC
> I suppose one viable solution might be to have slots like the above, and imperatively _generate_ content for the slots if they are empty. I guess this could work but it feels like a hack, and is fairly _weird_.
You can provide default content for slots, so you could create a shadowdom like so:
```html
<img-input>
<template shadowrootmode="open">
<slot name="browse"><button>Browse...</button></slot>
</template>
</img-input>
```
Then `<img-input></img-input>` will have the default slot contents of the "Browse..." button but `<img-input><button slot="browse">Browse!</button></img-input>` would have a `Browse!` button from the light DOM.
That's not to say your point isn't valid - that would still be an awkward API, but it's somewhat _less_ awkward than imperative generation of content.
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/986#issuecomment-1460318358
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/986/1460318358@github.com>
Received on Wednesday, 8 March 2023 15:18:22 UTC