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

2.5 KB
Raw Blame
The Border Box element is used to display structured items in a list, each with a set of actions.

<%= embed OpPrimer::BorderBoxComponentPreview, :default %>

## Anatomy

The Border Box element is made up of

1. The **header**, which acts as a container for the items below and helps distinguish between sections. It is optional.
2. Individual **items** below can vary in what information they show.

If a page uses a Border Box with a header, all sections must use headers.

## Header

The header can either be static or collapsible.

The CollapsibleHeader brings additional functionality:

- an **arrow indicator** next to the title  indicates if the section is collapsed or expanded.
- a **header description** (optional) to give additional context to the content of that section. Hidden when collapsed.
- a **counter** (optional) displays the number of items that that particular section contains.

When collapsed, the bottom border is slightly thicker to indicate something is hidden.

Both the collapsible and static headers can accept additional actions. For example, a **more button** can offer additional contextual actions such as edit, delete and move (move up, move to top, move down, move to the end).

<%= embed OpPrimer::BorderBoxComponentPreview, :collapsible %>

## Uses

Some places in which we already use the Border Box:

- to display individual meeting agenda items in a meeting
- to display the a list of project attributes in Project settings
- to display a list of configured OAuth applications

If the content needs to be more structured (with columns and column headers), please use the [Border Box Table](./tables/border_box_table) component instead.

## Best practices

**Do**

- Use sections (with headers) to better organise content if they have logical categories (eg. Open and Planned meetings).
- Do make the header and items draggable if the user should be able to drag individual items  up and down and into other sections. The sections themselves can also be dragged up and down to change order.

**Don't**

- Don't mix sections with and without headers. If one section has a header, they must all have headers.
- Don't make sections collapsible if they do not need to be.

## Technical notes

<%= embed OpPrimer::BorderBoxComponentPreview, :collapsible, panels: %i[source] %>

For detailed examples have a look at the other [border box preview examples](/lookbook/inspect/primer/beta/border_box/playground) or the [collapsible header preview examples](/lookbook/inspect/primer/open_project/border_box/collapsible_header/playground).