open(input?, config?)
Open Spotlight. If an input is supplied, it will prefill Spotlight's search input with that value. Optionally, open Spotlight with a tab or filter preselected.
Example
// Open Spotlight
window.CommandBar.open();
// Open Spotlight with "say hi" prefilled
window.CommandBar.open("say hi");
// Open Spotlight with the Navigation category preselected
window.CommandBar.open("", { categoryFilter: "navigation" });
// Open Spotlight with the category with ID 1 preselected
window.CommandBar.open("", { categoryFilter: 1 });
// Add a record set, and open Spotlight filtering on that record set with "apple" prefilled
window.CommandBar.addRecords("fruit", [
{
label: "Apple",
value: "apple",
description: "Red fruit",
},
{
label: "Banana",
value: "banana",
description: "Yellow fruit",
},
]);
window.CommandBar.open("apple", { categoryFilter: "fruit" });
Method parameters
input
string
Optional input to prefill the Spotlight's search field.