useWidgetTheme
Overview
Resolves the active theme function for a widget, combining validation state with any additional context.
Signature
useWidgetTheme(componentName, props, widgetContextState, additionalContext, keyFn)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| componentName | string | yes | The theme component name (must exist in the active theme). |
| props | ThemeProps | yes | The reactive or computed component props. |
| widgetContextState | object | yes | The widget context state. |
| additionalContext | object | no | Extra reactive context entries to merge into the theme context. |
| keyFn | (key: string, kwargs: object) => string | no | Optional function to modify a key based on kwargs. |
widgetContextState Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| adaptedValue | any | The widget’s value adapted for UI concerns. | ||
| combinedLabel | string | The effective label of the widget. | ||
| combinedName | string | The effective name of the widget, from props or field context. | ||
| combinedValue | any | The widget’s effective form value (local or contextual). | ||
| dependencyValues | object | Dependency values from context, if any. | ||
| disabled | boolean | Whether the widget is disabled. | ||
| fieldToWidget | ValueAdapter | The value adapter for turing form values into values suitable for UI concerns. | ||
| focused | boolean | Whether the widget is currently focused. | ||
| formModelName | string | The form model name from the field context. | ||
| help | string | The help text, from props or field context. | ||
| readOnly | boolean | Whether the widget is read-only. | ||
| required | boolean | Whether the widget is required. | ||
| touched | boolean | Whether the widget has been interacted with. | ||
| validationState | object | Validation state flags. | ||
| widgetToField | ValueAdapter | The value adapter for the widget values back into form values, for validation and submission concerns. |
Returns
Source
client/lib/use/useWidgetTheme.js:18