Initial setup
Setup @codegouvfr/react-dsfr in your project or start from a template
Last updated
Was this helpful?
Setup @codegouvfr/react-dsfr in your project or start from a template
Last updated
Was this helpful?
If you already had the DSFR installed in your project, let's start from scratch:
Remove from your dependencies.
Remove the import ofdsfr.css, dsfr.module.js the favicon and the fonts.
Remove the data-fr-scheme
(and data-fr-theme
) attribude from your <html/>
tag
If you want a more complete starter with a Ready yo use stack that includes routing, autentication, internationalisation ect. you can also use this starter instead:
Add these three scripts to your package.json
:
Trigger the execution of the postinstall script by running:
Add the following tags in the <head />
You're all set! Next step for you is to setup the integration with your routing library (react-router for example).
You can avoid having a flash of unstyled text by preloading the font variant used on your homepage (look in the network tab of your browser dev tools what are the font downloaded initially).
Add the following tags in the <head />
Using Nx monorepo? See .
This documentation is for (aka the legacy next setup).
Your framework isn't supported? Let's ! Note: We don't have a custom integration for it but react-dsfr has been reported working with .