Skip to content

How to implement component slots and named slots? #75

@mikebronner

Description

@mikebronner

Let's say we have a component that uses slots, how should that be defined in the storybook args?

For example, a more complex component that uses slots and sub-components:

<x-ui.buttons.general
    class="flex items-center gap-2 px-4 py-1 text-gray-600 border border-gray-500 rounded-md hover:bg-gray-500 hover:text-gray-100"
>
    <x-slot
        name="loadingIcon"
    >
        <x-icons.solid.cog
            class="w-4 h-4 shrink-0"
        />
    </x-slot>
    <x-slot
        name="icon"
    >
        <x-icons.light.csv
            class="w-4 h-4 shrink-0"
        />
    </x-slot>
    <span>
        Export To CSV
    </span>
</x-ui.buttons.general>

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