ConstThe current PropertyFormContext instance.
import { useReactiveSnapshot, DISPATCH_SYNC } from "@open-pioneer/reactivity";
function CustomForm() {
const context = usePropertyFormContext();
const name = useReactiveSnapshot(() => context.properties.get("name") ?? "", [context], DISPATCH_SYNC);
useEffect(() => {
context.isValid = name.length >= 1;
}, [context, name]);
return (
<input
value={name}
onChange={(e) => context.properties.set("name", e.target.value)}
/>
);
}
React hook for accessing the property form context.
Provides access to the PropertyFormContext instance, which contains the current feature being edited and methods to read and update its properties. This hook must be called from within a component that is rendered inside a property form (typically in a custom form rendered by DynamicFormTemplate).
The context also allows controlling the form's validity by setting the
isValidproperty, which determines whether the save button is enabled.