Styled-Components Usage in React Components

Syncfusion® React components support custom styling using the styled-components library.

Adding styled-components to the application

To style a Syncfusion® React component using styled-components, follow these steps:

  1. Import styled-components in the src/App.tsx file.

  2. Use the styled factory to wrap the Syncfusion® React component.

  3. Override the component's styles to create a styled version of it.

The following code demonstrates how to create a styled Syncfusion® React Button component using styled-components:

The output will appear as follows:

Styling with dynamically computed props

We can style the Syncfusion React components dynamically based on props.

The below example code shows the dynamically styling the components using props.

The output will appear as follows: