Search⌘ K
AI Features

Defining and Using Theme Props

Explore how to define CSS theme properties using variables for colors and backgrounds, and implement a basic toggle mechanism to switch between light and dark themes. Understand how to apply these theme props effectively within your app's design, setting the foundation for more advanced theming techniques.

Having CSS variables change values between different themes is the main way by which our theming platform will work. This lesson includes a simple example that toggles between a light and a dark theme of an app. This example will also show what we mean by defining a theme and how we’ll use the theme props in our app.

Example: Toggling between dark and light mode #

Let’s assume our themes have 2 props, --background (background color) and ...