Skip to main content

Search panel configuration

Search panel is the horizontal button container in the content part of the app in free drive state. The UX Framework exposes options to let users hide it, change its position or show different buttons.

Let’s say your UX team realized that the search panel should be displayed on top of the screen and some pre-defined categories should be replaced with home and work locations:

Dash.init(
context = this,
accessToken = getString(R.string.mapbox_access_token),
) {
ui {
searchPanel {
visible = true
position = SearchPanelPosition.TOP_LEFT
buttons = listOf(DashSearchPanelButton.Favorite(PersonalLocations.Home), DashSearchPanelButton.Favorite(PersonalLocations.Work), DashSearchPanelButton.Category(SearchCategory.Parking))
}
}
}

It is also possible to display custom buttons in the search panel:

DashSearchPanelButton.Custom(
id = "my button",
iconId = R.drawable.my_button,
onClick = {
// handle my button click
},
)
Was this page helpful?