Skip to content

Commit ba38524

Browse files
DataViews: update docs for layout prop (#73470)
Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
1 parent 01136d1 commit ba38524

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

packages/dataviews/CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
- Simplify field normalization and types. [#73387](https://github.com/WordPress/gutenberg/pull/73387)
88
- DataViews table layout: make checkboxes permanently visible when bulk actions are available. [#73245](https://github.com/WordPress/gutenberg/pull/73245)
9-
- Documentation: surface better the `type` property in the documentation. [#73349](https://github.com/WordPress/gutenberg/pull/73349)
109
- DataViews: Make sticky elements (table headers, footer, actions column) inherit background colors from parent container. This allows DataViews instances to seamlessly adapt to containers with custom background colors. [#73240](https://github.com/WordPress/gutenberg/pull/73240)
1110
- DataViews table layout: only apply hover styles when bulk actions are available. [#73248](https://github.com/WordPress/gutenberg/pull/73248)
12-
- Improve docs for Edit component. [#73202](https://github.com/WordPress/gutenberg/pull/73202)
13-
- Field API: introduce the `format` prop to format the `date` field type. [#72999](https://github.com/WordPress/gutenberg/pull/72999)
1411
- DataViews: add support for activity layout. [#72780](https://github.com/WordPress/gutenberg/pull/72780)
12+
- Field API: introduce the `format` prop to format the `date` field type. [#72999](https://github.com/WordPress/gutenberg/pull/72999)
13+
- Documentation: improve Edit component. [#73202](https://github.com/WordPress/gutenberg/pull/73202)
14+
- Documentation: surface better the `type` property in the documentation. [#73349](https://github.com/WordPress/gutenberg/pull/73349)
15+
- Documentation: improve DataView's `layout` prop. [#73470](https://github.com/WordPress/gutenberg/pull/73470)
1516

1617
### Bug fixes
1718

packages/dataviews/README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,37 @@ Properties:
223223
224224
##### Properties of `layout`
225225
226-
| Properties of `layout` | Table | Grid | List |
227-
| ------------------------------------------------------------------------------------------- | ----- | ---- | ---- |
228-
| `badgeFields`: a list of field's `id` to render without label and styled as badges. | | ✓ | |
229-
| `styles`: additional `width`, `maxWidth`, `minWidth`, `align` styles for each field column. | ✓ | | |
226+
| Props / Layout | `table` | `pickerTable` | `grid` | `pickerGrid` | `list` | `activity` |
227+
| -------------- | ------- | ------------- | ------ | ------------ | ------ | ---------- |
228+
| `density` | ✓ | ✓ | | | | ✓ |
229+
| `enableMoving` | ✓ | ✓ | | | | |
230+
| `styles` | ✓ | ✓ | | | | |
231+
| `badgeFields` | | | ✓ | ✓ | | |
232+
| `previewSize` | | | ✓ | ✓ | | |
233+
234+
`table` and `pickerTable` layouts:
235+
236+
- `density`: one of `comfortable`, `balanced`, or `compact`. Configures the size and spacing of the layout.
237+
- `enableMoving`: whether the table columns should display moving controls.
238+
- `styles`: additional `width`, `maxWidth`, `minWidth`, `align` styles for each field column.
230239
231240
**For column alignment (`align` property), follow these guidelines:**
232241
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).
233242
243+
`grid` and `pickerGrid` layout:
244+
245+
- `badgeFields`: a list of field's `id` to render without label and styled as badges.
246+
- `previewSize`: a `number` representing the size of the preview.
247+
248+
`list` layout:
249+
250+
- None
251+
252+
`activity` layout:
253+
254+
- `density`: one of `comfortable`, `balanced`, or `compact`. Configures the size and spacing of the layout.
255+
256+
234257
#### `onChangeView`: `function`
235258

236259
Callback executed when the view has changed. It receives the new view object as a parameter.

0 commit comments

Comments
 (0)