Installation
To install the CDS library for React web applications, run the following command:
Alternatively, if you are using Yarn:
Getting started
1. Import global styles
Some global and icon styles are required for components to render correctly. Import these styles near your application entry point.
See the globalStyles
source code here →
If you are using the CDS defaultTheme
you should also import the default font styles.
2. Render a ThemeProvider and MediaQueryProvider
Render a ThemeProvider at the root of your application, and pass the theme
and activeColorScheme
.
Render a MediaQueryProvider for components that use the useMediaQuery
hook.
The MediaQueryProvider prevents issues with window.matchMedia()
in SSR environments. Read more here
3. Verify the installation
Try importing and rendering a simple CDS component.
Example implementation
Here's an example React DOM app using the defaultTheme
.
Next steps
Learn how to customize CDS's appearance.