How to use it
- Select a Checkbox filter and turn on its hierarchical option.
- Tick Collapsible sub-terms (Kiln).
- Open the page. Each term that has children shows a toggle. Click it to show or hide the sub-terms.
- Optional: choose how the groups start, allow one open group at a time, and style the toggle (see below).
Options (shown once Collapsible sub-terms (Kiln) is ticked)
- Initial state: Closed, except groups with an active term (the default), All closed or All open. The visitor's own clicks win over this while they stay on the page.
- One group open at a time: when a visitor opens a group, Kiln closes the other open groups under the same parent. It acts on clicks, so with All open every group still starts open.
- Toggle icon: any icon from Bricks' icon picker, such as a plus. Empty keeps the small chevron.
- Toggle position: after the label (the default) or before it. Before it, rows without sub-terms move in by the toggle's width so the labels line up.
- Toggle size, Toggle color and Toggle color when open. Like other Bricks style fields, they take breakpoints and the hover state.
- Icon rotation when open: degrees, 180 by default. Set 0 for an icon that shouldn't rotate, or 45 to turn a plus into a cross.
For the indent of child terms, use Bricks' own Indent: Gap and Indent: Prefix controls on the filter.
Where it appears in Bricks
Checkbox filter element, Content tab: Collapsible sub-terms (Kiln), right after the hierarchical option, and the options above directly under it. They show only while the filter is hierarchical and Limit options is empty.
How it works
- Folding works at any depth. A sub-term with children of its own gets its own toggle.
- By default 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 toggle 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 toggle.
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 on the Kiln page. The options sit on each Checkbox filter. Turn the module on in Bricks > Kiln (it is on by default).
Requirements
Bricks 2.4 or newer.