Skip to content

useTheme ​

Overview ​

A hook to get the classes for a given key and kwargs. Uses computeds for caching.

If the resolved slot entry declares composes, the referenced slots are resolved first (recursively) and their classes prepended to the result. See the module description for composition semantics and the meta-key naming convention.

Signature ​

useTheme(componentName, props, context, keyFn)

Parameters ​

NameTypeRequiredDescription
componentNamestringyesThe name of the component.
propsThemePropsyesThe reactive or computed props to pass to the class function.
contextanynoThe context to pass if the config or config.class is a function.
keyFn(key: string, kwargs: any) => stringnoA function to modify a key based on kwargs.

Returns ​

UseThemeReturnFunction

A function that returns the classes for a given key and kwargs.

Source ​

client/lib/use/useTheme.js:322