codegouvfr / react-dsfr

🇫🇷 The French Government Design system React toolkit
https://react-dsfr.codegouv.studio
MIT License
416 stars 56 forks source link

Icon in main navigation #320

Closed zelytra closed 1 week ago

zelytra commented 1 week ago

Is it possible to replace the text in the main navigation component by an icon ? Like having a bell for the notificaiton page within the navigation bar ? Or is this not acessibility friendly this feature ?

enguerranws commented 1 week ago
export namespace Item {
        export type Common = {
            isActive?: boolean;
            className?: string;
            text: ReactNode;
        };
        ...

You surely can insert an icon in the navigation items in react-dsfr's MainNavigation.

However, that case is not documented, and the DSFR team only describe use cases with text, so I'm not even sure DSFR's style will work if you insert an icon there.

Be sure to run an accessibility tool to check your implementation if you want to do so.