Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

1.9 KB
Raw Blame
The <strong>CollapsibleSection</strong> allows you to make section headers of a page collsible/expandable. This is especially useful when the page consists of lots of information grouped in smaller semantic chunks. Making these sections collapsible allows the user to quickly scan the content first at a header-level and then expand the section with the information that is relevant to them.

<%= embed Patterns::CollapsibleSectionPreview, :default %>

## Anatomy

The CollapsibleSection consists of two basic parts: the title and the content below it that will be collapsed. The title offers some additional options.

- The title
  - A caption (optional): Text, shown next to the title in a subtle colour
  - Additional information (optional): Free content, shown at the end of the title row
- The collapsible content area

## Best practices

**Do**
- Do use the CollapsibleSection if a page has a lot of information that can be grouped into logical section and the user is likely to want to be able to scan through the list of available sections

**Don't**

- Don't use the CollapsibleSection if you want to collapse the content of a BorderBox. Use the [BorderBox::CollapsibleHeader](./tables/border-box-table.md.erb) instead.
- Don't collapse the sections if the user benefits from seeing all content on the page, without hiding any part of it
- Don't use too complex elements for the `additional_information` slot. It is designed for small texts or an individual button.

## Used in

* The time report overview, where each section can represent a single day or a single week, allowing the user to scan through and find the right date for which want to create or find a time entry

## Technical notes

<%= embed Patterns::CollapsibleSectionPreview, :full_example, panels: %i[source] %>

## Examples

For detailed examples have a look at the other [preview examples](/lookbook/inspect/primer/open_project/collapsible_section/default) of the component.