General Styling

August 22, 2025

Understanding the Theming System

Think of our theming system as a set of style instructions that cascade through your components, similar to CSS but with more structure and type safety. Each component has specific customizable areas, called theme keys, that you can target for styling.

The theming system provides a structured way to customize the appearance of components while maintaining their functionality and accessibility. It allows you to:

  • Target specific elements within a component
  • Apply consistent styling across your application
  • Ensure type safety and prevent styling errors

Theme Key Structure

Every theme key in our system follows a predictable pattern that makes it easy to target specific elements within a component:

  1. Component Name: The base name of the component (e.g., banner, widget, dialog)
  2. Element Path: The path to the element within the component (e.g., header.title, footer.accept-button)
  3. State Variations: Optional state indicators (e.g., switch.thumb.checked, button.hover)

Component Hierarchies

Components are structured in a hierarchical manner, which is reflected in their theme keys:

Each level in the hierarchy can be styled independently, giving you fine-grained control over the appearance.

Visualizing the Hierarchy

Here's a simplified visualization of a typical accordion component:

Using Theme Context

For consistent styling across your application, you can use the ThemeProvider component to apply a global theme:

Theme Inheritance

Components can still define their own themes, which will merge with and override the global theme:

Type-Safe Styling

Our theming system includes TypeScript support to help prevent errors:

Disabling Default Styles

Sometimes you might want to start from scratch. Use the noStyle prop to remove all default styling: