Browse all documentation

Collapsible field

Group advanced controls behind an accessible disclosure without nesting their stored values.

Use field.Collapsible to keep optional or advanced controls available without making the default editor overwhelming. It changes presentation only; children stay at their current document path.

In the admin

An opened Advanced collapsible in the Ridu admin with populated Internal name and Editor notes controls.

Collapsing changes only presentation; child values remain at their existing document paths.

Smallest working example

content/pages.go
field.Collapsible(
  "advancedSettings",
  true,
  field.Text("canonicalURL", field.Label("Canonical URL")),
  field.JSON("providerMetadata"),
)

The second argument controls whether the disclosure starts collapsed. The document has root canonicalURL and providerMetadata properties; there is no advancedSettings object.

Child fields retain their own labels, descriptions, validation, access, conditions, and generated contracts. Opening or closing the disclosure never changes submitted values.

When to use it

Collapsibles work well for infrequent metadata and power-user settings. Do not put required fields or the primary task behind a closed disclosure without a clear error path—the author should be able to find and correct validation issues.

Use Group when children need a stored object boundary, and Tabs when a long form needs peer sections rather than optional detail.

Common mistakes

  • Collapsed is not hidden. Values are still read, submitted, validated, and authorized.
  • Moving existing fields into a Collapsible is presentation-only; changing their names or nesting is a migration.
  • Keep the label meaningful to screen-reader and keyboard users; do not rely on an icon alone.

See field.Collapsible and Admin field layout.