Skip to main content

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.


// Open Spotlight;

// Open Spotlight with "say hi" prefilled"say hi");

// Open Spotlight with the Navigation category preselected"", { categoryFilter: "navigation" });

// Open Spotlight with the category with ID 1 preselected"", { 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",
]);"apple", { categoryFilter: "fruit" });

Method parameters



Optional input to prefill the Spotlight's search field.



Configure how Spotlight should open.

categoryFilterstring | numberOpen Spotlight with a filter preselected. If the filter exists as a tab, the tab will be selected; if not, a tag that says the filter is applied will show. Accepts either a category name or a record set name as a string or a category ID as an integer.