Skip to content
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

Slots #75

Open
cekvenich2 opened this issue Jul 3, 2021 · 3 comments
Open

Slots #75

cekvenich2 opened this issue Jul 3, 2021 · 3 comments
Labels
FAQ Good reading for frequently asked questions

Comments

@cekvenich2
Copy link

I like it, very nice an light.

Is there an example of using slots from a page?

@Raynos
Copy link
Member

Raynos commented Jul 3, 2021

Can you explain more what the slots feature is ? Is that a feature from a different framework. Do you have an pseudo code example of what you would like to do ?

Are you talking about the HTML5 <slot> tag or the slot / v-slot feature in vuejs ?

@cekvenich2
Copy link
Author

is a standard use by all web component frameworks: https://developers.google.com/web/fundamentals/web-components/customelements

@heapwolf
Copy link
Member

heapwolf commented Aug 30, 2021

I never added slots because you don't need them. it's a concept that no one needs to learn with tonic if they understand javascript string literals.

render () {
  const slotted = 'hello, world'

  return this.html`
    <p> ${ slotted } </p>
  `
}

More succinctly, <slot> === ${slot}. the slotted variable can contain almost anything, not just primitive values, for example more html...

const slotted = this.html`
  <another-component parent=${this}></another-component>
`

@heapwolf heapwolf added the FAQ Good reading for frequently asked questions label Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ Good reading for frequently asked questions
Projects
None yet
Development

No branches or pull requests

3 participants