To prepend a searchfield to the menu or to (some of) the panels,
use the searchfield options and configuration.
<script>
document.addEventListener(
"DOMContentLoaded", () => {
new Mmenu( "#menu", {
searchfield: {
// searchfield options
}
}, {
searchfield: {
// searchfield configuration
}
});
}
);
</script>
<script>
document.addEventListener(
"DOMContentLoaded", () => {
}
);
</script>
Options for the "searchfield" add-on
| Option | Datatype | Default value | Description |
| searchfield | |||
|---|---|---|---|
| { | |||
| add | boolean |
false |
Whether or not to automatically prepend a searchfield to the menu or (some of the) panels. |
| addTo | String HTMLElement[] |
"panels" |
Where to add the searchfield(s). Possible values:
|
| noResults | String |
"No results found." |
The text to show when no results are found.
If false no message will be shown. |
| placeholder | String |
"Search" |
The placeholder text for the searchfield. |
| search | Boolean |
true |
Whether or not to actually search the listitems. |
| searchIn | String |
"panels" |
What panels to search in. Possible values:
|
| splash | String |
|
HTML to show while there is no searchterm provided. |
| title | String |
"Search" |
The title for the searchpanel. |
| } | |||
Configuration for the "searchfield" add-on
| Option | Datatype | Default value | Description |
| searchfield | |||
|---|---|---|---|
| { | |||
| cancel | boolean |
false |
Whether or not to add a cancel button after the searchfield. |
| clear | boolean |
false |
Whether or not to add a clear button to the searchfield. |
| form | Object |
null |
Adds the specified keys/values as attributes to the FORM. |
| input | Object |
null |
Adds the specified keys/values as attributes to the INPUT. |
| panel | Object |
null |
Adds the specified keys/values as attributes to the searchpanel. |
| submit | boolean |
false |
Whether or not to add a submit button to the searchfield. |
| } | |||
CSS variables for the "searchfield" add-on
The "searchfield" add-on has no CSS variables.
API methods for the "searchfield" add-on
The "searchfield" add-on has no API methods.