Skip to content

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

NameTypeRequiredDescription
componentNamestringyesThe theme component name (must exist in the active theme).
propsThemePropsyesThe reactive or computed component props.
widgetContextStateobjectyesThe widget context state.
additionalContextobjectnoExtra reactive context entries to merge into the theme context.
keyFn(key: string, kwargs: object) => stringnoOptional function to modify a key based on kwargs.

widgetContextState Properties

NameTypeRequiredDefaultDescription
adaptedValueanyThe widget’s value adapted for UI concerns.
combinedLabelstringThe effective label of the widget.
combinedNamestringThe effective name of the widget, from props or field context.
combinedValueanyThe widget’s effective form value (local or contextual).
dependencyValuesobjectDependency values from context, if any.
disabledbooleanWhether the widget is disabled.
fieldToWidgetValueAdapterThe value adapter for turing form values into values suitable for UI concerns.
focusedbooleanWhether the widget is currently focused.
formModelNamestringThe form model name from the field context.
helpstringThe help text, from props or field context.
readOnlybooleanWhether the widget is read-only.
requiredbooleanWhether the widget is required.
touchedbooleanWhether the widget has been interacted with.
validationStateobjectValidation state flags.
widgetToFieldValueAdapterThe value adapter for the widget values back into form values, for validation and submission concerns.

Returns

UseThemeReturnFunction

Source

client/lib/use/useWidgetTheme.js:18

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2