Theme Customization in Syncfusion® React Components

This guide demonstrates various ways to customize the appearance of Syncfusion® React Components, enabling you to design the UI according to your application's requirements.

Inline styles via style Prop

Styles can be applied directly to a React component by using the style prop. This prop accepts a JavaScript object that defines the desired CSS properties and values.

External stylesheets

Define styles in an external CSS file and apply them using the className prop.

Example:

Theming using the React context API

Use React’s Context API to define and provide a theme across your application. This approach allows centralized control over component styles.

This example shows how the Button component can consume the theme context to apply consistent, centralized theming throughout the app.

Using styled-components

The styled-component library library allows you to write actual CSS in your JavaScript, enabling dynamic styling and scoped styles.

For more details on styled-components features in React Components, refer to the styled-component documentation.

Applying global styles

Users can apply global styles using either traditional CSS or styled-components.

Using regular CSS

Global CSS styles are typically placed in a file like global.css. This file contains style rules that apply to HTML elements everywhere in your application. By defining styles in one place, you can ensure consistent formatting and colors across different pages and components.

Using styled-components with global Styles

Use styled-components to define and apply global styles across your application.