Skip to content

Allow to fill slots through props #11216

Closed
@lianulloa

Description

@lianulloa

What problem does this feature solve?

I'm making a modal component, which has as default body a simple card. This card has header, body and footer. Each one of these has a slot within. The structure would be something like this:

Modal
  Card
    Header
      slot
    Body
      slot
    Footer
      slot

So, it works fine declaratively. But I want to be able to use this modal like a global component and to open and set its content, from any other component through a function call (using a event bus for example). For this I want to be able to set the content in those slots through props to the modal

What does the proposed API look like?

Maybe it could be something like this:

<modal $slots="{headerSlot: <some-component || just-text />, bodySlot: ... } " />

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