androidx.compose.material3
ExpandedDockedSearchBarWithGapSince 1.11Experimental
Composable function
One of the search bar types. It works like SearchBar. Only the parameters that differ are described here.
The results open as a separate drop-down, with a small gap under the field.

val text = rememberTextFieldState()
val state = rememberSearchBarState(SearchBarValue.Expanded)
val field = @Composable {
SearchBarDefaults.InputField(textFieldState = text, searchBarState = state, onSearch = {}, placeholder = { Text("Search photos") })
}
Box(Modifier.size(360.dp, 320.dp)) {
SearchBar(state = state, inputField = field, modifier = Modifier.width(328.dp))
ExpandedDockedSearchBarWithGap(state = state, inputField = field) { Suggestions() }
}
@Composable
fun Suggestions() {
listOf("Beach", "Mountains", "Snow").forEach {
ListItem(
headlineContent = { Text(it) },
leadingContent = { Icon(Icons.Filled.Search, null) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent),
)
}
}
ParametersExperimental
@Composable
fun ExpandedDockedSearchBarWithGap(
state: SearchBarState,
inputField: @Composable () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = SearchBarDefaults.dockedShape,
dropdownShape: Shape = SearchBarDefaults.dockedDropdownShape,
dropdownGapSize: Dp = SearchBarDefaults.dockedDropdownGapSize,
dropdownScrimColor: Color = SearchBarDefaults.dockedDropdownScrimColor,
colors: SearchBarColors = SearchBarDefaults.colors(),
tonalElevation: Dp = SearchBarDefaults.TonalElevation,
shadowElevation: Dp = SearchBarDefaults.ShadowElevation,
properties: PopupProperties = PopupProperties(focusable = true, clippingEnabled = false),
content: @Composable ColumnScope.() -> Unit,
)
dropdownShape: ShapeOptional
dropdownShape: ShapeOptionalDefault: SearchBarDefaults.dockedDropdownShape
The outline of the results panel under a docked bar with a gap.
dropdownGapSize: DpOptional
dropdownGapSize: DpOptionalDefault: SearchBarDefaults.dockedDropdownGapSize
The gap between the field and the results panel.
dropdownScrimColor: ColorOptional
dropdownScrimColor: ColorOptionalDefault: SearchBarDefaults.dockedDropdownScrimColor
The color of the dim layer behind the results panel.
properties: PopupPropertiesOptional
properties: PopupPropertiesOptionalDefault: PopupProperties(focusable = true, clippingEnabled = false)
Window options for the expanded bar, like whether back closes it.
Defaults that differ from SearchBar:
Same as in SearchBar: state, inputField, modifier, shape, colors, tonalElevation, shadowElevation, content.
Search bar types
SearchBarDockedSearchBarAppBarWithSearchExpandedFullScreenSearchBarExpandedFullScreenContainedSearchBarExpandedDockedSearchBarExpandedDockedSearchBarWithGap
See also
SearchBarDefaults: default values and helper functions forExpandedDockedSearchBarWithGap.