π CSS in JS
Compatibility with solutions like styled-components, emotion and TSS.
import { fr } from "@codegouvfr/react-dsfr";
export type Props = {
className?: string;
};
export const MyComponent =(props: Props) => {
const { className } = props;
return (
<div
className={className}
style={{
padding: fr.spacing("10v"),
//SEE: https://components.react-dsfr.codegouv.studio/?path=/docs/%F0%9F%8E%A8-color-helper--page
backgroundColor: fr.colors.decisions.background.alt.blueFrance.active
}}
>
<span
className={fr.cx("fr-p-1v")}
style={{
...fr.spacing("margin", { "topBottom": "3v" })
}}
>
Hello World
</span>
</div>
);
};
spacing

breakpoints

colors
Using CSS variables (recommended)
Using HEX color code
useIsDark()
useBreakpointsValuesPx()
Last updated
Was this helpful?
