Can you use the ::slotted() pseudo selector to target a specific named slot

Viewed 2917

I am creating a custom element which contains both a default (ie unnamed) slot and some named ones. I specifically want to style the content of one of the named slots, but not any of the others.

Is there a way of selecting a specific named slot.

As an example of the sort of thing I want to do, my custom element contains a dialog box - like so:

<dialog>
 <slot></slot> <!-- general content -->
 <div class="buttons">
  <slot name="action"></slot>
  <slot name="cancel"></slot>
 </div>
</dialog>

and I want to style all the action buttons a solid color and the cancel buttons a more washed out color.

0 Answers
Related