shoelace-style/shoelace

<sl-icon color> inconsistencies

Open

#2,382 opened on Feb 20, 2025

View on GitHub
 (4 comments) (0 reactions) (0 assignees)TypeScript (922 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (13,867 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Describe the bug

The <sl-icon> docs say

Icons inherit their color from the current text color. Thus, you can set the color property on the element or an ancestor to change the color.

All of the examples in the docs show style="color: #...;", not color="...".

<sl-icon> itself does accept color and sets it on the element, but that has no effect:

sl-icon with color

The React wrapper also accepts color?: string, but it does nothing.

To Reproduce

Create an <sl=icon color="#fedcba">

Additional information

Recommended actions:

  1. change the documentation to describe style="color: ..." rather than color="...", consistent with the examples and the working code
  2. non-breaking change: if <sl-icon> receives a color, emit a warning message
  3. breaking change: remove color from the accepted attributes for <sl-icon> and <SlIcon>

Contributor guide