Skip to content

Proposal: Improve icon creation pattern and SVG → React component standardization #829

@elizabetdev

Description

@elizabetdev

There are a few areas where I think we could further improve our icon creation approach and make it more consistent and scalable.

Related context:
#819 (review)

First, similar to what was done in #828, we could standardize converting SVGs into React components.

While looking into the current icon structure, I also noticed that we have a wrapper around the icons that overrides stroke and fill colors:

${({ theme, $color = 'currentColor', $width, $height, $size }) => `
& path[stroke], & svg[stroke]:not([stroke="none"]), & rect[stroke], & circle[fill] {
stroke: ${$color};
}
& path[fill], & svg[fill]:not([fill="none"]), & rect[fill], & circle[fill] {
fill: ${$color};
}

This logic ends up overriding the original color and stroke values defined in the SVGs.

Image

From my perspective, this creates unnecessary overhead. We’re adding extra code inside the SVG React components that ultimately gets overridden by the wrapper anyway.

A cleaner approach would be for SVG components to use currentColor by default when they’re transformed into React components. That way:

  • Icons automatically inherit color from the parent wrapper
  • We avoid redundant SVG attributes
  • Passing custom colors remains flexible and straightforward
  • The overall pattern becomes simpler and more maintainable

Additional observations

Some icons define explicit stroke widths:
Image

Image

Others don’t:
Image

Do we want to allow overriding stroke widths? If yes, it would be great to make this consistent across all icons. If not, we could standardize and remove those attributes to keep the system simpler.

I think the design team first needs to take some decisions here. Happy to discuss this proposal on the next click-ui sync.

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