instantsearch.widgets.panel({ // Optional parameters hidden: function, collapsed: function, templates: object, cssClasses: object, });
About this widget #
The panel
widget wraps other widgets in a consistent panel design. It also reacts by adding a CSS class when the widget can no longer refine. For example, when a refinementList
becomes empty because of the current search results.
Examples #
1
2
3
4
5
6
7
8
9
10
const refinementListWithPanel = instantsearch.widgets.panel({
templates: {
header: 'Brand',
},
})(instantsearch.widgets.refinementList);
refinementListWithPanel({
container: '#refinement-list',
attribute: 'brand',
});
Options #
hidden
# |
type: function
default: () => false
Optional
A function that is called on each render to determine if the panel should be hidden based on the render options. If the function returns |
||
Edit
Copy
|
|||
collapsed
# |
type: function
Optional
A function that is called on each render to determine if the panel should be collapsed based on the render options. Providing this option adds the CSS class |
||
Edit
Copy
|
|||
templates
# |
type: object
Optional
The templates to use for the widget. |
||
|
|||
cssClasses
# |
type: object
default: {}
Optional
The CSS classes to override.
|
||
Edit
Copy
|
Templates #
header
# |
type: string|function
Optional
The template used for displaying the header. It exposes:
|
||
Edit
Copy
|
|||
footer
# |
type: string|function
Optional
The template used for displaying the footer. It exposes:
|
||
Edit
Copy
|
|||
collapseButtonText
# |
type: string|function
Optional
The template used for displaying the collapse button. It exposes:
|
||
Edit
Copy
|
HTML output#
1
2
3
4
5
6
7
<div class="ais-Panel">
<div class="ais-Panel-header">
<span>Header</span>
</div>
<div class="ais-Panel-body">Panel content</div>
<div class="ais-Panel-footer">Footer</div>
</div>