Modules / Query loops & dynamic data

Query filter: collapsible sub-terms

Filter: collapsible sub-terms

Fold the sub-terms of a hierarchical Checkbox filter under their parent. Each parent gets a chevron button, and its children stay hidden until a visitor opens it.

#16 of 39 modules by votes

  • On by default
  • Needs Bricks 2.4 or newer
  • Tested with Bricks 2.4.3

Tile 16 of 39, ranked by votes · Recording in progress

Where to find it in the builder

Checkbox filter element, Content tab: Collapsible sub-terms, right after the hierarchical option. The control shows only while the filter is hierarchical and Limit options is empty.

How to use it

  1. Select a Checkbox filter and turn on its hierarchical option.
  2. Tick Collapsible sub-terms.
  3. Open the page. Each term that has children shows a chevron. Click it to show or hide the sub-terms.

How it works

  • Folding works at any depth. A sub-term with children of its own gets its own chevron.
  • A group that contains a ticked term starts open. If the visitor closes it, it stays closed.
  • When Bricks refreshes the filter by AJAX, Kiln restores which groups were open.
  • Each chevron is a button with a label such as "Show sub-terms: Shoes" or "Hide sub-terms: Shoes", so screen readers announce which term it controls. The button also reports whether the group is open.
  • A parent that Bricks marks as empty (no results) gets no chevron.

Limits

  • It does not work together with Limit options (Bricks' Show more). Both hide rows, so the control is hidden while Limit options has a value.
  • Folding applies on the front end only. The builder canvas shows every row.
  • Without JavaScript, every row shows.
  • The script and stylesheet load only on pages with a filter that uses the option.

Settings

None. Turn the module on in Bricks > Kiln (it is on by default).

Requirements

Bricks 2.4 or newer.