Styles resolver system for BlazeUI.
BlazeUI resolves styles, based on a combination of a component's default classes,
variants, and custom classes that are passed via props.
It deuplicates classes that would override each other, using
tailwind-merge
and allows to truthy/falsy class assignment via clsx
.
Usually you do not have to access this manually, but using
api.styles()
in the respective component methods.
- Source:
Members
(static) merge
Merges classnames, using cn tailwind-merge and clsx
- Source:
Methods
(static) create(component)
Re-/create a new style resolver for a given component.
Parameters:
Name | Type | Description |
---|---|---|
component |
UIComponent |
- Source:
(static) extract(component, props) → {Object}
Extract attachable styles for a given component.
Parameters:
Name | Type | Description |
---|---|---|
component |
UIComponent | |
props |
object | non-reactive object of the current component props |
- Source:
Returns:
- Type
- Object
(static) flatten(obj) → {string}
Transforms a styles object into a styles-string.
Only covers own/enumerable properties.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object |
- Source:
Returns:
- Type
- string
(static) get(ctx, options, …classNames) → {string}
Resolves classnames for the given Component context.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ctx |
UComponent | ||
options |
object | ||
classNames |
Array.<string> |
<repeatable> |
- Source:
Returns:
- Type
- string