# WidgetsFormProvider

**Category:** Base Components/Providers

## API

### Overview

`WidgetsFormProvider` wraps form content in Entity/Settings pages to provide widget-level form context. It enables custom form widgets (like `CustomFieldsWidget`) to register with the page form and participate in validation and submission. Place it inside `` or `` content.

```tsx
import { WidgetsFormProvider } from '@wix/patterns/page';
```

The `WidgetsFormProvider` is designed to being used as an alternative in cases where [EntityPage](./?path=/story/base-components-pages-entity-page--entitypage) doesn’t cover your needs (for example, you have a side panel and not a full page experience for editing your entity). It enables you to include form-based widgets such as [TagsWidget](./?path=/story/features-enrich-tags--tagswidget) and [CustomFieldsWidget](./?path=/story/features-enrich-data-extension-components--customfieldswidget), and access the page’s state and to validate the widgets data through the [useWidgetsFormContext](./?path=/story/common-hooks--usewidgetsformcontext) hook.

In any case that you have a full page experience, we suggest to use [EntityPage](./?path=/story/base-components-pages-entity-page--entitypage) and not to use `WidgetsFormProvider`, so you can get more out of the box capabilities.


### Usage

Wrap your page with `WidgetsFormProvider`

```diff
+ import { WidgetsFormProvider } from '@wix/patterns/page';

export const MyPageProvider = () => {

    return (
+       
            
+       
    )
}
```

Inside the page, you will be able to access the `state` object returned from the [useWidgetsFormContext](./?path=/story/common-hooks--useformpagecontext) hook.

```diff
+ import { useWidgetsFormContext } from '@wix/patterns';

export const MyEntityPage = () => {

+   const state = useFormPageContext();

    return (
        
             {
+                           const { isValid, data } = await state.validate();
+                           if (isValid) await handleSubmit();
                        }}
                    >
                        Save
                    
                }
            />
    )
}
```


