Skip to content

Accordion Item

The Accordion Item is a header row with a title and a chevron. A click on it opens or closes it, and the state is written to open. Use it as the heading of a section in a list that the operator can open and close. It is found in the Embedding - OpenBridge section of the Perspective Component Palette as Accordion Item.

Three Accordion Items stacked, with dividers

The parts of the item:

  1. Title — the text in title.
  2. Chevron — points down when the item is closed and up when it is open.
  3. Divider — an optional line below the item. See Divider.

An Accordion Item dropped from the palette is closed and has the title Accordion Item:

Accordion Item with default properties

The content of an open item is another view, not components dropped onto the item: the Accordion Item is not a container. Set viewPath to the view to show below the header, and viewParams to the parameters passed to it; the names in viewParams must match the parameters of that view. With viewPath empty, opening the item only turns the chevron (animated, unless the operator’s system is set to reduce motion) and nothing appears below it.

Open item with a view of three readouts

The view is shown at its own default height and the item’s width. A view cannot embed the view it is placed in: the item then shows Perspective’s error state instead of the view.

The item does not grow its box when it opens, so the view overflows a box sized for the header. Put the item in a Flex Container with position.basis set to auto, or bind the height of the box to open, so the components below move down (see Example 1).

For a card with a description, a status label and an icon, use the Accordion Card instead.

The item fills the width of its box (the blue frame) and is 48 px tall (1 px more when open); the box of a new item is 320 × 48.

Accordion Item and its box


A click anywhere on the item toggles it. The item writes the new state to open and fires onActionPerformed. Set or bind open to open or close the item from elsewhere.

Closed Closed item
Open Open item

disabled greys the item out and ignores clicks on it: open is not changed and no event is fired.

Disabled item

Note: A click writes open. In the Designer, a click in Preview Mode changes the property, and the change is saved with the view.

Name Description Property Type
title Text of the item. Default Accordion Item. value
open Whether the item is open. Written by the item when the operator clicks it. Default false. value
disabled Grey the item out and ignore clicks. Default false. value

showDivider draws a line along the bottom of the item, to separate the items of a list:

Item with a divider

Name Description Property Type
showDivider Draw a line below the item. Default false. value

Properties not covered in the sections above:

Name Description Property Type
style Standard Perspective style object. object
Event Description Event Object
onActionPerformed Fired when the operator opens or closes the item, after open is written. Not fired when the item is disabled, nor when open is changed by a binding or a script. —

To act on the new state, read self.props.open in the event script.

Example 1 — A Section That Opens and Closes

Section titled “Example 1 — A Section That Opens and Closes”
  1. Add a Flex Container with direction column.
  2. Drop an Accordion Item into it, set title to Pumps and showDivider to true, and set its position.basis to auto.
  3. Set viewPath to the pump overview, for example Machinery/Pumps. The view is shown below the header when the item is open, and the items below move down.
  4. Repeat for Valves and Tanks to build a list of sections.

Built on the OpenBridge Design System