From 0a7ed8b46c7743632f93e2ec001f7e777f5440a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:29:25 +0100 Subject: [PATCH 01/10] Document missing isValid values --- packages/dataviews/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 0daccdbc88b4cc..5542c0d505cd77 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -1621,6 +1621,11 @@ Object that contains the validation rules for the field. If a rule is not met, t - `required`: boolean indicating whether the field is required or not. Disabled by default. - `elements`: boolean restricting selection to the provided list of elements only. Enabled by default. The `array` Edit control uses it to restrict the input values. +- `pattern`: a regex pattern string that the field value must match. +- `minLength`: minimum string length for the field value. +- `maxLength`: maximum string length for the field value. +- `min`: minimum numeric value for the field. +- `max`: maximum numeric value for the field. - `custom`: a function that validates a field's value. If the value is invalid, the function should return a string explaining why the value is invalid. Otherwise, the function must return null. Fields that define a type come with default validation for the type. For example, the `integer` type ensures that the value is a valid integer: From 55d733632c0844a16aca4e2fcac35e73ec73f63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:31:40 +0100 Subject: [PATCH 02/10] Document validity --- packages/dataviews/README.md | 50 +++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 5542c0d505cd77..4e5f3019ffc1d6 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -893,7 +893,9 @@ return ( Object that determines the validation status of each field. There's a `useFormValidity` hook that can be used to create the validity object — see the utility below. This section documents the `validity` object in case you want to create it via other means. -The top-level props of the `validity` object are the field IDs. Fields declare their validity status for each of the validation rules supported: `required`, `elements`, `custom`. If a rule is valid, it should not be present in the object; if a field is valid for all the rules, it should not be present in the object either. +The top-level props of the `validity` object are the field IDs. Fields declare their validity status for each of the validation rules supported: `required`, `elements`, `pattern`, `minLength`, `maxLength`, `min`, `max`, `custom`. If a rule is valid, it should not be present in the object; if a field is valid for all the rules, it should not be present in the object either. + +A field's validity can also contain a `children` property (`Record`) for nested field validity when using combined fields. For example: @@ -910,6 +912,32 @@ For example: "message": "Value must be one of the elements." } }, + "slug": { + "pattern": { + "type": "invalid", + "message": "Must match the required pattern." + } + }, + "description": { + "minLength": { + "type": "invalid", + "message": "Must be at least 10 characters." + }, + "maxLength": { + "type": "invalid", + "message": "Must be at most 200 characters." + } + }, + "price": { + "min": { + "type": "invalid", + "message": "Must be at least 0." + }, + "max": { + "type": "invalid", + "message": "Must be at most 9999." + } + }, "publisher": { "custom": { "type": "validating", @@ -982,6 +1010,26 @@ Returns an object containing: type: 'invalid', message: 'Value must be one of the elements.' // Optional }, + pattern: { + type: 'invalid', + message: 'Must match the required pattern.' + }, + minLength: { + type: 'invalid', + message: 'Must be at least 10 characters.' + }, + maxLength: { + type: 'invalid', + message: 'Must be at most 200 characters.' + }, + min: { + type: 'invalid', + message: 'Must be at least 0.' + }, + max: { + type: 'invalid', + message: 'Must be at most 9999.' + }, custom: { type: 'validating', message: 'Validating...' From d226692f04a4cc748487ea743747356c492bac0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:33:53 +0100 Subject: [PATCH 03/10] Document format prop for datetime fields --- packages/dataviews/README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 4e5f3019ffc1d6..31fb8bf588b868 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -2005,11 +2005,30 @@ Valid operators per field type: ### `format` -Display format configuration for fields. Supported for date, number, and integer fields. This configuration affects how the field is displayed in the `render` method, the `Edit` control, and filter controls. +Display format configuration for fields. Supported for `datetime`, `date`, `number`, and `integer` fields. This configuration affects how the field is displayed in the `render` method, the `Edit` control, and filter controls. - Type: `object`. - Optional. +For `datetime` fields: +- Properties: + - `datetime`: The format string using PHP date format (e.g., `'M j, Y g:i a'` for `'Jan 1, 2021 2:30 pm'`). Optional, defaults to WordPress date format settings. + - `weekStartsOn`: Specifies the first day of the week for calendar controls. One of 0, 1, 2, 3, 4, 5, 6. Optional, defaults to WordPress "Week Starts On" setting, whose value is 0 (Sunday). + +Example: + +```js +{ + id: 'createdAt', + type: 'datetime', + label: 'Created At', + format: { + datetime: 'M j, Y g:i a', + weekStartsOn: 1, + }, +} +``` + For `date` fields: - Properties: - `date`: The format string using PHP date format (e.g., 'F j, Y' for 'March 10, 2023'). Optional, defaults to WordPress "Date Format" setting. From 1ef0842da8526111d8cd03754ba7ec253ecd7be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:35:43 +0100 Subject: [PATCH 04/10] Document density for list layout --- packages/dataviews/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 31fb8bf588b868..956b57129c7e91 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -238,7 +238,7 @@ Properties: | Props / Layout | `table` | `pickerTable` | `grid` | `pickerGrid` | `list` | `activity` | | -------------- | ------- | ------------- | ------ | ------------ | ------ | ---------- | -| `density` | ✓ | ✓ | | | | ✓ | +| `density` | ✓ | ✓ | | | ✓ | ✓ | | `enableMoving` | ✓ | ✓ | | | | | | `styles` | ✓ | ✓ | | | | | | `badgeFields` | | | ✓ | ✓ | | | @@ -260,7 +260,7 @@ Right-align whenever the cell value is fundamentally quantitative—numbers, dec `list` layout: -- None +- `density`: one of `comfortable`, `balanced`, or `compact`. Configures the size and spacing of the layout. `activity` layout: From 3623c07896725ba50b8a2c9ad26d0a2468935e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:37:31 +0100 Subject: [PATCH 05/10] Update view object docs --- packages/dataviews/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 956b57129c7e91..43f4bde000501c 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -230,7 +230,9 @@ Properties: - `field`: the field used for grouping the dataset. - `direction`: the direction to use for sorting the groups, one of `asc` or `desc`. Default `asc`. + - `showLabel`: whether to show the field label in the group header. `true` by default. +- `infiniteScrollEnabled`: whether infinite scroll is enabled. `false` by default. - `fields`: a list of remaining field `id` that are visible in the UI and the specific order in which they are displayed. - `layout`: config that is specific to a particular layout type. From 815f4b5af482a11ca10f9a523631d1c61dc7d4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:40:49 +0100 Subject: [PATCH 06/10] Document DataForm details layout --- packages/dataviews/README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 43f4bde000501c..71b51f58a7c832 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -2109,7 +2109,7 @@ Example: ### `layout` -Represents the type of layout used to render the field. It'll be one of Regular, Panel, Card, or Row. This prop is the same as the `form.layout` prop. +Represents the type of layout used to render the field. It'll be one of Regular, Panel, Card, Row, or Details. This prop is the same as the `form.layout` prop. #### Regular @@ -2205,6 +2205,25 @@ For example: } ``` +#### Details + +- `type`: `details`. Required. +- `summary`: Summary field configuration. Optional. Specifies which field to display in the details summary. A string (single field ID) + +The Details layout renders the field inside a collapsible `
` HTML element. The `summary` property controls the text shown in the disclosure summary. + +For example: + +```js +{ + id: 'field_id', + layout: { + type: 'details', + summary: 'summaryFieldId' + }, +} +``` + ### `label` The label used when displaying a combined field, this requires the use of `children` as well. From 42f4b9d70ec55934e6fab35159f8176438d3afa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:43:34 +0100 Subject: [PATCH 07/10] Add missing row styles and form field description --- packages/dataviews/README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 71b51f58a7c832..69f2b8ff6de353 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -2190,6 +2190,7 @@ For example: - `type`: `row`. Required. - `alignment`: one of `start`, `center`, or `end`. Optional. `center` by default. +- `styles`: an object mapping field IDs to style objects. Each style object supports a `flex` property (any valid CSS `flex` value) to control how the field sizes within the row. Optional. The Row layout displays fields horizontally in a single row. It's particularly useful for grouping related fields that should be displayed side by side. This layout can be used both as a top-level form layout and for individual field groups. @@ -2200,7 +2201,11 @@ For example: id: 'field_id', layout: { type: 'row', - alignment: 'start' + alignment: 'start', + styles: { + field1: { flex: '1 1 auto' }, + field2: { flex: '0 0 200px' }, + }, }, } ``` @@ -2240,6 +2245,24 @@ Example: } ``` +### `description` + +A string describing the form field's purpose or usage. Used to provide additional context. + +- Type: `string`. +- Optional. + +Example: + +```js +{ + id: 'field_id', + label: 'Status & Visibility', + description: 'Control the publish status and visibility of the post.', + children: [ 'status', 'password' ], +} +``` + ### `children` Groups a set of fields defined within children. For example if you want to display multiple fields within the Panel dropdown you can use children ( see example ). From 87b49ae8651520c3db443ae74bc443568fedaec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:45:43 +0100 Subject: [PATCH 08/10] Document missing props for Edit --- packages/dataviews/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 69f2b8ff6de353..0cb89fe12cbe45 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -1583,6 +1583,8 @@ Finally, the field author can always provide its own custom `Edit` control. It r - `field`: the field definition - `onChange`: the callback with the updates - `hideLabelFromVision`: boolean representing if the label should be hidden +- `markWhenOptional`: boolean indicating whether to label the control as "optional" when the field is not required, instead of showing "required" +- `operator`: the currently selected filter operator for this field. Used by DataViews filters to determine which control to render based on the operator type - `validity`: object representing the validity of the field's value (see validity section) - `config`: object representing extra config for the component: - `prefix`: a React component to be rendered as a prefix From 9dd5963b038936ee97071c7de482393e1fe628c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:57:31 +0100 Subject: [PATCH 09/10] Update last bits --- packages/dataviews/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 0cb89fe12cbe45..5b2a2ace244756 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -207,7 +207,7 @@ const view = { Properties: -- `type`: view type, one of `table`, `grid`, `list`. See "Layout types". +- `type`: view type, one of `table`, `grid`, `list`, `activity`, `pickerTable`, `pickerGrid`. See "Layout types". - `search`: the text search applied to the dataset. - `filters`: the filters applied to the dataset. Each item describes: - `field`: which field this filter is bound to. @@ -250,10 +250,10 @@ Properties: - `density`: one of `comfortable`, `balanced`, or `compact`. Configures the size and spacing of the layout. - `enableMoving`: whether the table columns should display moving controls. -- `styles`: additional `width`, `maxWidth`, `minWidth`, `align` styles for each field column. +- `styles`: additional `width`, `maxWidth`, `minWidth`, `align` styles for each field column. The `align` property accepts `'start'`, `'center'`, or `'end'`. **For column alignment (`align` property), follow these guidelines:** -Right-align whenever the cell value is fundamentally quantitative—numbers, decimals, currency, percentages—so that digits and decimal points line up, aiding comparison and calculation. Otherwise, default to left-alignment for all other types (text, codes, labels, dates). +Right-align (`'end'`) whenever the cell value is fundamentally quantitative—numbers, decimals, currency, percentages—so that digits and decimal points line up, aiding comparison and calculation. Otherwise, default to left-alignment (`'start'`) for all other types (text, codes, labels, dates). `grid` and `pickerGrid` layout: @@ -402,7 +402,7 @@ What text to show in the search input. "Search" by default. Whether the data is loading. `false` by default. -#### `defaultLayouts`: `Record< string, view >` +#### `defaultLayouts`: `Object` This property limits the available layout and provides layout information about active view types. If empty, this enables all layout types (see "Layout Types") with empty layout data. @@ -419,7 +419,7 @@ const defaultLayouts = { }; ``` -The `defaultLayouts` property should be an object that includes properties named `table`, `grid`, `list`, and `activity`. These properties are applied to the view object each time the user switches to the corresponding layout. +The `defaultLayouts` property should be an object that includes properties named `table`, `grid`, `list`, `activity`, `pickerTable`, and `pickerGrid`. These properties are applied to the view object each time the user switches to the corresponding layout. #### `selection`: `string[]` @@ -825,7 +825,7 @@ const fields = [ ]; ``` -#### `form`: `Object[]` +#### `form`: `Object` - `layout`: an object describing the layout used to render the top-level fields present in `fields`. See `layout` prop in "Form Field API". - `fields`: a list of fields ids that should be rendered. Field ids can also be defined as an object and allow you to define a `layout`, `labelPosition` or `children` if displaying combined fields. See "Form Field API" for a description of every property. @@ -1134,7 +1134,7 @@ Function that performs the required action. ```js { - callback: ( items, { onActionPerformed } ) => { + callback: ( items, { registry, onActionPerformed } ) => { // Perform action. onActionPerformed?.( items ); }; @@ -1281,7 +1281,7 @@ Example: React element used by some layouts (table, grid) to display the field name — useful to add icons, etc. -- Type: React element. +- Type: `string` | React element. - Optional. - Defaults to the `label` value. From f459d37e04873837bba0e3d79a99ebcc1c821029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:59:52 +0100 Subject: [PATCH 10/10] Update changelog --- packages/dataviews/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dataviews/CHANGELOG.md b/packages/dataviews/CHANGELOG.md index ac22a5b6187267..578dc2ff859492 100644 --- a/packages/dataviews/CHANGELOG.md +++ b/packages/dataviews/CHANGELOG.md @@ -10,6 +10,7 @@ ### Enhancements +- Documentation: Update README.md. [#75881](https://github.com/WordPress/gutenberg/pull/75881) - DataViews: Adjust column spacing in table layout when no titleField is provided. [#75410](https://github.com/WordPress/gutenberg/pull/75410) ## 12.0.0 (2026-02-18)