Skip to content

Add a minimized option to repeaters - #114

Merged
dnnsjsk merged 1 commit into
inline0:7.7.2from
Contributolo:feat/repeater-minimized
Oct 15, 2026
Merged

dnnsjsk merged 1 commit into
inline0:7.7.2from
Contributolo:feat/repeater-minimized

Conversation

@Contributolo

Copy link
Copy Markdown
Collaborator

Closes #95.

Repeaters with many rows get long in the sidebar. This adds a minimized option:

{
  "id": "items",
  "type": "repeater",
  "minimized": true,
  "textMinimized": { "id": "title" },
  "attributes": [{ "id": "title", "type": "text", "label": "Title" }]
}
  • Rows that exist when the field mounts start collapsed, showing their textMinimized label.
  • Rows added in the editor start expanded, so a new row can be filled in right away.
  • A row the user expands stays expanded after a reload. The state lives in localStorage like the collapsed rows of other repeaters, but under its own key (blockstudioRepeaterExpanded), because for these repeaters the stored rows are the expanded ones. Repeaters without the option behave as before.

Changes: repeater.tsx, the minimized property in the four repeater definitions of block.json and extend.json (checksums updated), the types (by hand, like the other recent options, since npm run types fails with s.codePointAt is not a function in quicktype on Node 20 and 26), the field reference via npm run docs:generate, the LLM index, and a test block with an e2e test (tests/e2e/types/repeater/minimized.ts).

I ran the new e2e test and the existing repeater tests (repeater.ts, default-rows.ts, nested.ts, 49 tests) against a local WordPress Playground site set up like wp-env (test theme, /e2e/setup, bundle rebuilt locally): all green. With the committed bundle the new test fails at "existing rows start collapsed", as it should. npm run check passes. Bundles are not rebuilt in this PR.

If you prefer a different name, or a "collapse all" control instead of an option, I am happy to change it.

Repeaters with many rows get long in the sidebar (inline0#95). With
"minimized": true the rows that exist when the field mounts start
collapsed. Rows added in the editor start expanded so they can be filled
in, and a row the user expands stays expanded, stored like the
collapsed rows of other repeaters but under its own key.

The option is in the block and extend schemas, the types and the field
reference. A test block and an e2e test cover collapsed existing rows,
an expanded new row and an expanded row after a reload.
@dnnsjsk
dnnsjsk changed the base branch from main to 7.7.2 October 15, 2026 11:07
@dnnsjsk
dnnsjsk merged commit 6902dfd into inline0:7.7.2 Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can repeaters default to minimised?

2 participants