androidx.compose.material3
ExpandedFullScreenContainedSearchBarSince 1.11Experimental
Composable function
One of the search bar types. It works like SearchBar. Only the parameters that differ are described here.
Like ExpandedFullScreenSearchBar, but the field keeps its pill shape and the results sit in a box under it.

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, 360.dp)) {
SearchBar(state = state, inputField = field)
ExpandedFullScreenContainedSearchBar(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 ExpandedFullScreenContainedSearchBar(
state: SearchBarState,
inputField: @Composable () -> Unit,
modifier: Modifier = Modifier,
collapsedShape: Shape = SearchBarDefaults.inputFieldShape,
colors: SearchBarColors = SearchBarDefaults.containedColors(state = state),
tonalElevation: Dp = SearchBarDefaults.TonalElevation,
shadowElevation: Dp = SearchBarDefaults.ShadowElevation,
windowInsets: @Composable () -> WindowInsets = { SearchBarDefaults.fullScreenWindowInsets },
properties: DialogProperties = DialogProperties(),
content: @Composable ColumnScope.() -> Unit,
)
collapsedShape: ShapeOptional
collapsedShape: ShapeOptionalDefault: SearchBarDefaults.inputFieldShape
The outline of the field before the full-screen bar opens.
windowInsets: @Composable () -> WindowInsetsOptional
windowInsets: @Composable () -> WindowInsetsOptionalDefault: { SearchBarDefaults.fullScreenWindowInsets }
Space kept free for system bars. The default is usually right.
properties: DialogPropertiesOptional
properties: DialogPropertiesOptionalDefault: DialogProperties()
Window options for the expanded bar, like whether back closes it.
Defaults that differ from SearchBar:
colors=SearchBarDefaults.containedColors(state = state)
Same as in SearchBar: state, inputField, modifier, colors, tonalElevation, shadowElevation, content.
Search bar types
SearchBarDockedSearchBarAppBarWithSearchExpandedFullScreenSearchBarExpandedFullScreenContainedSearchBarExpandedDockedSearchBarExpandedDockedSearchBarWithGap
See also
SearchBarDefaults: default values and helper functions forExpandedFullScreenContainedSearchBar.