Skip to content

[FEAT] Expose default slot as prop #119

Description

@cossssmin

Would be useful to be able to get the content passed to a component as a prop, i.e.:

// button.html
<script props>
  module.exports = {
    yield: $slots.default // or props.yield maybe?
  }
</script>

<!--[if mso]>
  <a href="...">{{ yield }}</a>
<![endif]-->
<a href="..." style="mso-hide: all">
  <yield />
</a>

This way we could render the <yield /> tag in HTML comments where it doesn't render normally, through a prop.

Yes it can be passed like a prop but tbh this looks stupid to me, plus it's cumbersome to pass HTML as the label:

<x-button href="..." label="Hello World">
  Hello World
</x-button>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions