> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simplifi.work/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter accordion

The panel collapses and expands via a Bootstrap 4.6 accordion. When collapsed, any active filter selections are shown as pills in the header row so the user can see what's applied at a glance.

***

## Preview

<Frame>
  <img src="https://mintcdn.com/simplifi/zV9Ml0SiQbwykvnu/images/Snag_29b1b01c.png?fit=max&auto=format&n=zV9Ml0SiQbwykvnu&q=85&s=f428d73c88f02cf6e58e0275c4b2e05b" alt="Snag 29b1b01c" width="695" height="451" data-path="images/Snag_29b1b01c.png" />
</Frame>

<Note>
  As of 29/07/2026, the accordian can be found in the app on the leave module and schedule page
</Note>

***

## HTML Structure & JS

<CodeGroup>
  ```html Collapsed state theme={null}
  <div id="ID_Filters">
    <div class="accordion" id="FiltersAccordion">
      <div class="ssPanel">

        <!-- Accordion trigger -->
        <button class="ssFilterHeader" type="button"
                data-toggle="collapse" data-target="#Filters_Data"
                aria-expanded="false">
          <i class="bi bi-sliders"></i>
          <span class="ssFilterTitle">Filters</span>
          <span id="ID_FilterPills" class="ssFilterPillBar"></span>
          <i class="bi bi-chevron-right ssFilterArrow"></i>
        </button>

        <!-- Collapsible body -->
        <div class="collapse" id="Filters_Data"
             data-parent="#FiltersAccordion">
          <div class="ssFilterBody">

            <div class="ssFilterColumn" name="leftFilters">
              <!-- all your left hand columns go here -->
            </div>

            <div class="ssFilterColumn" name="rightFilters">
              <!-- all your right hand columns go here -->
            </div>

          </div>

        </div>

      </div>
    </div>
  </div>
  ```

  ```javascript js theme={null}
  //This is the JS that you will need to put into the method
  document.querySelector(".ssFilterHeader").addEventListener("click", function () {
  	  var expanded = this.getAttribute("aria-expanded") === "true";
  	  this.setAttribute("aria-expanded", String(!expanded));
  	});

  //Provides the shortcut
  $(document).off("keydown.leaveFilters").on("keydown.leaveFilters", function(e) {
  	if (!$("#Filters_Data").hasClass("show")) return;

  	if (e.key === "Escape") {
  		if (e.target.tagName === "SELECT") e.preventDefault();
  		clearFilters();
  	}
  });

  //If you filters that are applied by default, you should
  //always call renderFilterPills() on load
  $(document).ready(function() {
  	renderFilterPills();
  });
  ```
</CodeGroup>

***

## Column Layout Logic

Filters can be distributed across two `.ssFilterColumn` divs or just put into the `.ssFilterBody` .

```css theme={null}
.ssFilterBody {
  margin-top: 10px;
  border-top: none;
  border-left: 1px solid rgb(204, 204, 204);
  margin-left: 10px; 
  padding-left: 20px; 

  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.ssFilterColumn {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 220px;
  width: 300px;
}
```

***

## Filter 'Pills'

There are filter 'pills' avaliable to you to display the user's selected filters in the top accordian body.

<Frame>
  <img src="https://mintcdn.com/simplifi/05ejElZcWuFjNZm4/images/Snag_29978bd9.png?fit=max&auto=format&n=05ejElZcWuFjNZm4&q=85&s=c00ff2f56771f2a7d2aac2b646e3f555" alt="Snag 29978bd9" width="696" height="439" data-path="images/Snag_29978bd9.png" />
</Frame>

Currently, the input types supported are:

* Multi-selects
* Single Selects
* Text Inputs
* Checkboxes

To enable pills on the accordion,

```html focus={6} theme={null}
<button class="ssFilterHeader" type="button"
        data-toggle="collapse" data-target="#Filters_Data"
        aria-expanded="false">
	  <i class="bi bi-sliders"></i>
	  <span class="ssFilterTitle">Filters</span>
	  <span id="ID_FilterPills" class="ssFilterPillBar"></span>
	  <i class="bi bi-chevron-right ssFilterArrow"></i>
</button>
```

Add a span element with the id= `ID_FilterPills` and class `ssFilterPillBar` .

Then on any filter you'd like to appear as a pill, add `ssFilterField `as a class, and add a `data-filter-label` with the name that you'd like to appear on the pill. It must be a plural (eg. roles)

```html focus={1} theme={null}
<div class="ssFilterField" data-filter-label="Leave Statuses">
	<b>Leave Status:</b>
	<select style="max-width:300px; font-weight:normal; margin-right:10px;" class="form-control" id="ID_LeaveStatusFilter" name="ID_LeaveStatusFilter" onChange="applyFilters()">
		<option value="">All Statuses</option>
		<option class="newoption" ' & (defaultStatus = SSLeaveRequest.Status_Pending).iff('selected','') & ' value="' & SSLeaveRequest.Status_Pending.toLower & '" style="display:none;">Pending</option>
		<option class="newoption" ' & (defaultStatus = SSLeaveRequest.Status_Parked).iff('selected','') & ' value="' & SSLeaveRequest.Status_Parked.toLower & '" style="display:none;">Parked</option>
		<option class="decisionoption" ' & (defaultStatus = SSLeaveRequest.Status_Approved).iff('selected','') & ' value="' & SSLeaveRequest.Status_Approved.toLower & '" style="display:none;">Approved</option>
		<option class="decisionoption" ' & (defaultStatus = SSLeaveRequest.Status_Declined).iff('selected','') & ' value="' & SSLeaveRequest.Status_Declined.toLower & '" style="display:none;">Declined</option>
	</select>
</div>
```

The class and label can sit on either a div wrapping the select/input on on the select/input element itself.

<Danger>
  For the pills to render, you **must** call the global function `renderFilterPills()` when you'd like them to be applied.
</Danger>

***

## Keyboard Shortcuts

These are active whenever the filter panel is open (i.e. `#Filters_Data` has the `.show` class).

| Key      | Action        |
| :------- | :------------ |
| `Escape` | Clear filters |

<Warning>
  Escape calls `e.preventDefault()` when the focused element is a `<select>`. This prevents the browser from collapsing the dropdown before the filter action runs. Do not remove this guard.
</Warning>

***

## CSS Classes

These classes are defined in the platform's shared stylesheet and must be present on any page that renders this component.

| Class              | Element    | Purpose                                                                                                                             |
| :----------------- | :--------- | :---------------------------------------------------------------------------------------------------------------------------------- |
| `.ssPanel`         | `div`      | Bordered, lightly shadowed container for the full accordion                                                                         |
| `.ssFilterHeader`  | `button`   | Full-width clickable trigger row; holds icon, title, pills, and arrow                                                               |
| `.ssFilterTitle`   | `span`     | Takes up remaining flex space between the icon and the pill bar                                                                     |
| `.ssFilterPillBar` | `span`     | Flex container written to by `renderFilterPills()`                                                                                  |
| `.ssFilterArrow`   | `i` (icon) | Rotates 90° via CSS transition when hovered over                                                                                    |
| `.ssFilterBody`    | `div`      | Flex row containing the two filter columns                                                                                          |
| `.ssFilterColumn`  | `div`      | Left or right column (`flex: 1`)                                                                                                    |
| `.ssFilterField`   | `div`      | Wraps a single label + control. The `data-filter-label` attribute is used as the pill text when this field has a non-default value. |

<Note>
  The `data-filter-label` attribute on `.ssFilterField` is what `renderFilterPills()` reads to generate the pill text. Keep it short — it appears inline in the collapsed header.
</Note>
