Skip to main content

use_design_system

Function use_design_system 

Source
pub fn use_design_system() -> DesignSystem
Expand description

Reads the resolved design system inside a component, and re-renders it when the answer changes.

ⓘ
let design = use_design_system();
if design.is_apple() {
    // AC, and no memory row
} else {
    // C, and a memory row
}

This is not how an application chooses a design system. Choosing is Theme::unified; this reads an answer already given. And it is not a way to paint colours by hand: what a role resolves to is still the design system’s, and reaching for a literal because this told you which system is running is the thing the role vocabulary exists to prevent.