Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add the ability to add classes to slots #4443

Copy link
Copy link
Closed
@tiddle

Description

@tiddle
Issue body actions

Is your feature request related to a problem? Please describe.
I want to be able to add classes to slots so that i can style them directly.

Describe the solution you'd like

App.svelte

<MyComponent>
    <ul slot="list">
       ...
    </ul>
</MyComponent>

MyComponent.svelte

<slot name="list" class="my-list-style">
   <p>No items found</p>
</slot>

Describe alternatives you've considered
This alternative works, but i still can't style the ul in my example correctly and it feels like it renders the fallback slot functionality useless.

{#if list.length}
<div class="my-list-style">
   <slot name="list" />
</div>
{:else}
<p>No items found</p>
{/if}

How important is this feature to you?
There are work arounds, but nothing clean. I just feel like this should be functionality that should be part of the slot feature.

eunukasiko, jwerre, therealnospoon, BrayamValero, bigkrp and 1 more

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.