Kitten has slots but what about named slots?
Yep, Kitten has those too (as of a few minutes ago in main) :kitten:🎉
Kitten has slots but what about named slots?
Yep, Kitten has those too (as of a few minutes ago in main) :kitten:🎉
CC @andrew_chou – I guess I must’ve been mulling it over in the back of my head since we last spoke since it just came to me that we can have named slots and implement them quite elegantly too (if I do say so myself) ;P
(As always, would love your thoughts.)
Oh, hee hee, I jumped the gun a bit. It’s *now* in main (and I just updated the distribution build too so if you install/update Kitten you should now be able to play with it).
Going to document it next :)
So, basically, say you have a component called SlottyMcSlotFace, in your page you’d do:
```js
import Slotty from './SlottyMcSlotFace.component.js'
export default function _ => html`
<${Slotty}>
<content for='face'>
<img src='/eyes.png' alt='eyes'>
</content>
</>
`
```
And in SlottyMcSlotFace:
```js
export default ({ slot }) => html`
<div>
${slot.face}
<img src='/nose.png' alt='node'>
<img src='/mouth.png' alt='mouth>
…
</div>
`
```
@aral nice! this is what I would've expected to be able to do given a prop that's called slot
@andrew_chou 🤓👍
@nielsa Thanks :)
@aral nice!
I might actually have created the Slotty McSlotFace example… (I’m not sure if this calls for an intervention or not but I know I’m having fun.)
:kitten:💕
https://codeberg.org/kitten/app/src/branch/main/examples/slotty-mcslotface
076萌SNS is a social network, courtesy of 076. It runs on GNU social, version 2.0.2-beta0, available under the GNU Affero General Public License.
All 076萌SNS content and data are available under the Creative Commons Attribution 3.0 license.