Skip to content

feat: six-icon now supports custom svgs#445

Open
fortesp wants to merge 43 commits intomainfrom
feat/six-icon-with-svg-support
Open

feat: six-icon now supports custom svgs#445
fortesp wants to merge 43 commits intomainfrom
feat/six-icon-with-svg-support

Conversation

@fortesp
Copy link
Collaborator

@fortesp fortesp commented Nov 19, 2025

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

#425

📝 Checklist

  • I have linked an issue or discussion.
  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • I have updated the documentation accordingly.
  • All tests are passing
  • New/updated tests are included
  • I have updated the "upcoming" section inside docs/changelog.md explaining the changes I contributed

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@fortesp fortesp linked an issue Nov 19, 2025 that may be closed by this pull request
@fortesp fortesp self-assigned this Nov 19, 2025
@fortesp fortesp requested a review from pennal November 19, 2025 10:52
@pennal pennal added this to the v5.2.0 milestone Nov 19, 2025

/**
* @since 1.0
* @since 5.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THe since indicates since when the component has been available. Pleas revert

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check

*
* Icon library for this instance. Overrides the global default.
* - "material-icons" → Material Icons
* - "material-icons" → Material Icons
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check

})
export class SixIcon {
/** Name of the icon, path to SVG file or a data image */
@Prop() src?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I already mentioned in #425 (comment)

Using src as the prop name for the input, in case when we are passing an icon name, makes no sense to me. I would separate the different types, meaning

  • src: SVG File or Data URL
  • name: Name of the icon => you can introduce this already, but keep the slot

If I put myself in the user's shoes, I find this to be a lot easier to understand.

You can then define a hierarchy, like src > name > slot

Copy link
Collaborator Author

@fortesp fortesp Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, i think it makes more sense than having prop name and prop src... how the users know which one takes priority? ... Just makes things more complicated than they should be. I will change it anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check

* - <svg><use/></svg> is better for styling (e.g. fill: red), but slower at rendering.
* - <img> is better for HTTP caching, but you cannot style the internal SVG elements.
*/
@Prop({ reflect: true }) inlineSvg: boolean = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed? What performance hit are talking about?

I would simply default to the <svg><use/></svg> since, as you mention, its better for styling

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see there img is good for HTTP caching... you can in some instances visually see the difference rendering/loading the icons...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is however a caveat which you have to put id="img" inside your svg for it to work and properties inside svg have precedence i.e. if you have fill in some vector you cannot override it from outside.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if there is a more elegant way to approach this... this is what i have at the moment.

Comment on lines +79 to +92
if (this.src !== undefined) {
if (isSvg) {
if (this.inlineSvg) {
return (
<svg part="svg">
<use href={`${this.src}#img`} />
</svg>
);
}
return <img src={this.src} />;
}
return this.src;
}
return <slot />;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (this.src === undefined) {
  return <slot />;
}

if (!isSvg) {
  return this.src;
}

if (!this.inlineSvg) {
  return <img src={this.src} />;
}

return (
  <svg part="svg">
    <use href={`${this.src}#img`} />
  </svg>
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your solution does not work if you want to have name prop... i will adjust it..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check

};

private renderContent(isSvg: boolean) {
if (this.src !== undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the svg here has precedence over the slot?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? When you explitly place a path to a SVG you are showing a more clear intention to use svg over anything else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check

<six-icon>sick</six-icon>
<six-icon>fort</six-icon>
<six-icon>castle</six-icon>
<six-icon src="fort"></six-icon>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment explaining the two possible ways to do this => slot and prop

}

/* ==========================================================================
Size helpers (unchanged API, a bit more explicit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the content inside the brackets

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check

belahorvath and others added 8 commits November 24, 2025 10:13
Co-authored-by: Leupp, Joel <joel.leupp@six-group.com>
* chore: update release pipeline to use trusted publisher

* chore: update release pipeline and separate into two jobs

* chore: improve condition for release type
* chore: readd missing insider release steps

* chore: fix insider workflow to be executed again on push in main branch
@colinscz colinscz removed this from the v5.2.0 milestone Nov 28, 2025
@colinscz colinscz added this to the v5.3.0 milestone Dec 1, 2025
…setup for regular release (#455)

* fix: issue with github pages build

* docs: adjusted changelog to reflect changes correctly

* chore: remove npm token auth for regular release and switch to node 24 for builds with provenance
pennal and others added 10 commits December 10, 2025 17:17
* docs: update changelog for v5.2.0

* docs: update process for creating a release
Co-authored-by: GitHub action <>
* refactor: playwright test infrastructure

- Add Playwright test fixtures with animation control
- Add coverage utilities and merge scripts
- Configure Playwright in stencil.config.ts
- Remove Puppeteer dependency
- Remove unused testUtil and animation.scss

* test: playwright tests for all components

Add comprehensive E2E tests covering:
- Functional behavior and state transitions
- Screenshot tests for visual regression
- Accessibility tests with axe-core
- Keyboard navigation following ARIA APG patterns

Remove legacy Jest spec tests in favor of Playwright tests.

* chore: update CI workflow and build configuration

- Update Node.js version to 24 in workflows
- Add Cobertura coverage report generation
- Fix artifact upload paths
- Update prettier configuration

* docs: add Playwright testing guide and reorganize documentation

- Add comprehensive Playwright testing documentation
- Create Contributing section with Getting Started, Architecture, Testing
- Add Playwright skill for Claude Code
- Use angular-html/angular-ts syntax highlighting
- Update README files

* ci: parallelize workflow into lint-and-test, e2e-tests, and build jobs
# Conflicts:
#	docs/changelog.md
#	package-lock.json
fix: prevent type-to-select for six-select autocomplete
…t of font (#468)

Co-authored-by: Leupp, Joel <joel.leupp@six-group.com>
* chore: upgrade dependencies to latest versions

Update all project dependencies including Stencil 4.41, Angular 19,
and framework output targets. Require Node.js >= 24 for all workspaces.

* fix: update framework bindings and migrate to ESLint flat config

- Migrate ui-library from .eslintrc.json to flat ESLint config
- Fix Angular output target to generate proper component bindings
- Update React output target with correct autocorrect boolean type
- Fix control value accessors to use proper inject() function
- Update examples and documentation to match new API

* fix: replace Sass @import with @use to fix deprecation warnings

Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
Update all component SCSS files to use the modern @use syntax.

* fix: update pkg-pr-new workflow to correctly publish the angular library

* chore: npm audit fixes

* ci: update dependency-review version to fix size issue

* docs: update changelog and doc files

---------

Co-authored-by: colinscz <19342760+colinscz@users.noreply.github.com>
Co-authored-by: GitHub action <>
@colinscz colinscz modified the milestones: v5.3.0, v5.4.0 Feb 5, 2026
@rspy rspy requested review from rspy and removed request for ibirrer and tkst8 March 4, 2026 15:07
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

File Coverage
All files 92%
www/build/src/components/six-breadcrumbs/six-breadcrumbs.tsx 90%
www/build/src/components/six-button/six-button.tsx 91%
www/build/src/components/six-checkbox/six-checkbox.tsx 93%
www/build/src/components/six-date/calendar-grid.ts 93%
www/build/src/components/six-date/six-date.tsx 96%
www/build/src/components/six-date/components/month-selection.tsx 90%
www/build/src/components/six-date/components/year-selection.tsx 91%
www/build/src/components/six-details/six-details.tsx 98%
www/build/src/components/six-dialog/six-dialog.tsx 98%
www/build/src/components/six-dropdown/six-dropdown.tsx 94%
www/build/src/components/six-error-page/six-error-page.tsx 90%
www/build/src/components/six-file-upload/six-file-upload.tsx 95%
www/build/src/components/six-group-label/six-group-label.tsx 83%
www/build/src/components/six-icon/six-icon.tsx 66%
www/build/src/components/six-icon-button/six-icon-button.tsx 90%
www/build/src/components/six-input/six-input.tsx 97%
www/build/src/components/six-item-picker/six-item-picker.tsx 99%
www/build/src/components/six-menu/six-menu.tsx 80%
www/build/src/components/six-menu-item/six-menu-item.tsx 99%
www/build/src/components/six-picto/six-picto.tsx 66%
www/build/src/components/six-progress-ring/six-progress-ring.tsx 75%
www/build/src/components/six-range/six-range.tsx 92%
www/build/src/components/six-rating/six-rating.tsx 96%
www/build/src/components/six-search-field/six-search-field.tsx 90%
www/build/src/components/six-select/six-select.tsx 88%
www/build/src/components/six-select/util.ts 75%
www/build/src/components/six-sidebar/six-sidebar.tsx 92%
www/build/src/components/six-sidebar-item-group/six-sidebar-item-group.tsx 95%
www/build/src/components/six-switch/six-switch.tsx 95%
www/build/src/components/six-tab/six-tab.tsx 91%
www/build/src/components/six-tab-group/six-tab-group.tsx 78%
www/build/src/components/six-textarea/six-textarea.tsx 87%
www/build/src/components/six-tile/six-tile.tsx 83%
www/build/src/components/six-tooltip/six-tooltip.tsx 94%
www/build/src/functional-components/form-control/form-control.tsx 89%
www/build/src/utils/animation.ts 88%
www/build/src/utils/error-messages.ts 84%
www/build/src/utils/event-listeners.ts 91%
www/build/src/utils/execution-control.ts 90%
www/build/src/utils/focus-visible.ts 83%
www/build/src/utils/icon.ts 92%
www/build/src/utils/modal.ts 75%
www/build/src/utils/popover.ts 83%
www/build/src/utils/scroll.ts 87%
www/build/src/utils/slot.ts 90%

Minimum allowed coverage is 0%

Generated by 🐒 cobertura-action against 09ed2fc

@rspy
Copy link
Collaborator

rspy commented Mar 4, 2026

Please forgive me if I'm not quite seeing through everything ;-) But there seem to be a lot of commits in this PR which have nothing to do with it, like the ones from Béla and Joel.
Shouldn't there be only these 12 commits in the PR?
main...feat/six-icon-with-svg-support

@@ -11,7 +11,7 @@
<script type="module">
document.addEventListener('DOMContentLoaded', () => {
// Set Material Symbols as the default for all <six-icon>
window.six.setDefaultIconLibrary('material-symbols');
// window.six.setDefaultIconLibrary('material-symbols');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to ship an icon called test.svg with the web-components?

'wght' 400,
'GRAD' 0,
'opsz' 24;
font-variation-settings: 'wght' 400,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is your formatter off or was it off before? I'd prefer it if the formatting stays as it was before, unless there are good reasons to remove the line break?

@pennal
Copy link
Collaborator

pennal commented Mar 11, 2026

Can you rebase this branch @rspy? I am seeing over 500 changed fiels which makes it a bit difficult to review 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

six-icon with SVG support

7 participants