lyne-components icon indicating copy to clipboard operation
lyne-components copied to clipboard

[Question]: How to register custom icons for sbb-icon

Open daniel-sc opened this issue 1 year ago • 1 comments

Preflight Checklist

It affects the following packages

Components

Your Question

How to register custom icons?

Give us a summary about your question

in https://lyne-storybook.app.sbb.ch/?path=/docs/elements-sbb-icon--docs it is hinted, that custom icons from another namespace could be used, but it is not clear how.

Provide as much useful information as you can

No response

daniel-sc avatar Apr 17 '25 07:04 daniel-sc

It's already possible, but we need to improve API and documentation (#3606)

jeripeierSBB avatar Apr 17 '25 14:04 jeripeierSBB

Hi @jeripeierSBB, how is it already possible to register and use a custom icon?

We want to use a custom icon for the sbb-status component. If it's already possible or it's planned for the near future, I would not need to implement a workaround.

cetide avatar Jul 17 '25 14:07 cetide

Yes, it is already possible. You can register your own icon namespace.

import { mergeConfig } from '@sbb-esta/lyne-elements/core/config.js';

mergeConfig({
  icon: {
    namespaces: new Map<string, string>()
      .set('your-namespace', 'https://domain-of-your-icons/')
  }
});

kyubisation avatar Jul 18 '25 15:07 kyubisation