@design-system-rte/react
v1.18.0
Published
React components for Luciole (RTE Design System)
Downloads
569
Readme
Installation
npm install @design-system-rte/react@design-system-rte/core is installed automatically as a dependency. See the root README for other packages.
Setup
Add Design System base styles:
import "@design-system-rte/react/style.css"; createRoot(document.getElementById("root")!).render( <StrictMode> <App /> </StrictMode>, );Add Branding/Theme Mixin:
Include the branding/theme mixin in your main
.scssfile. This will create a style scope for the components. (If you don't have scss support, you can use the .css files in@design-system/core/css/rte-themes.cssand add them to your main styles file).@use "@design-system-rte/core/design-tokens/tokens/mixins" as *; @include theme-selector("bleu_iceberg", "light");Add HTML Selector:
Add an HTML selector to define the context for applying component styles.
<body data-theme="bleu_iceberg" data-mode="light"> ... </body>data-themeis required on each themed scope. Whendata-modeis omitted, the mode is inherited from an ancestor carryingdata-mode. If no ancestor defines a mode,lightis used as the default.Use Components:
Implement the different components as documented in the Storybook provided with the library.
Routing / SPA navigation
By default, navigable components (Link, NavItem, NavMenu, SideNav, Header, Breadcrumbs) render a native <a> tag, which triggers a full page reload. To enable client-side (SPA) navigation with the router of your choice you can inject its Link component instead of the native <a> tag. This mechanism has no dependency on any routing library: you provide the component, the design system just renders it.
You can do it using via NavigationProvider configured once at the root of your app.
import { NavigationProvider } from "@design-system-rte/react";
import { Link as RouterLink } from "react-router-dom"; // or any other router library
<NavigationProvider linkComponent={RouterLink}>
<App />
</NavigationProvider>;You can also use the customLinkComponent prop on the Link component to override the default behavior for a specific link.
import { Link as RouterLink } from "react-router-dom"; // or any other router library
<Link to="/home" label="Home" customLinkComponent={RouterLink} />;Without any configuration, all components keep rendering our native <Link> component — this is fully backward compatible.
