mattinger
09/24/2026, 2:50 PMclass MyComponentStyle(...)
val LocalMyComponentStyle = compositionLocalWithComputedDefaultOf {
val myColors = LocalMyColors.currentValue
// use the colors here to create a default value
MyComponentStyle(...)
}
And then in the component, we can use the composition local to get the fully formed style.
My main concern is about the overhead of the composition local instances, and would it be better to have one large structure with all my component configurations, and then select what i want at the point of usage.
class ComponentStyles(
val myComponent: MyComponentStyle
)
val LocalComponentStyles = compositionLocalWithComputedDefaultOf { ... }
And then later grab it via: LocalComponentStyles.current.myComponent