SettingsControlProps

Interface of @webcodingcat/wp-app-framework/settings, for type checks in your IDE.

export interface SettingsControlProps<V = unknown> {
	value: V;
	onChange: (value: V) => void;
	path: Array<string | number>;
	groupValue: GroupValue;
	DefaultControl: Component<Record<string, never>>;
}

Props of a control registered with registerSettingsControl().

Members

value

value: V

The value the control replaces: a setting, a field of a value class or an item of a list.

onChange

onChange: (value: V) => void

Sets the value.

path

path: Array<string | number>

Where the value is in the group: the setting, the fields and, for list items, their index, e.g. ['schemes', 0].

groupValue

groupValue: GroupValue

The value of the whole group, with the changes not saved yet.

DefaultControl

DefaultControl: Component<Record<string, never>>

The control the settings page would show without yours; render it to add to it instead of replacing it.