Collapsible option for single (non-list) objects

Open
#256 5 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
frontend

Research direction

The issue names no file or component. The screenshot shows the editor's meta object panel at the bottom of the UI, so start by finding the component that renders object-typed fields there. Check the four comments for any agreed approach or maintainer decision before writing code. Done means an object field can be collapsed and expanded in the editor, with the default state settled in the discussion.

Written by the indexing model from the issue text.

Description

enhancement
Request

Let a single object field collapse, like list items can:

- name: meta
  label: SEO
  type: object
  collapsible:
    collapsed: true
    summary: "{fields.title}"
  fields:
    - name: title
      type: string
    - name: description
      type: text

Secondary groups such as SEO, social or advanced settings could then sit at the bottom of an entry, closed until needed. Entries with several of them are currently long to scroll through, especially for clients.

Current behaviour (3.0.1)
  • collapsible is only accepted under list (ListSchema in src/shared/configuration-schema.ts).
  • List items only collapse when there are two or more (options.collapsible && values.length > 1 in src/components/structured-content-field.tsx), so a one-item list doesn't work around it.
Suggestion
  • Accept collapsible: true | { collapsed, summary } on object fields, reusing the list item UI.
  • Use the same summary templates as lists, defaulting to the field label.
  • Expand it when one of its fields fails validation, so errors aren't hidden.
Dominant language
TypeScript
Stars
4.1k
Forks
564
Avg merge
8m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hunvreus/pagescms

All issues in hunvreus/pagescms

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.