SearchBarDefaults

Defaults used in SearchBar and DockedSearchBar.

Properties

Link copied to clipboard
@get:Composable
val dockedShape: Shape

Default shape for a DockedSearchBar.

Link copied to clipboard
val Elevation: Dp
Link copied to clipboard
@get:Composable
val fullScreenShape: Shape

Default shape for a SearchBar in the expanded state.

Link copied to clipboard

Default height for a search bar's input field, or a search bar in the unexpanded state.

Link copied to clipboard
@get:Composable
val inputFieldShape: Shape

Default shape for a search bar's input field, or a search bar in the unexpanded state.

Link copied to clipboard

Default shadow elevation for a search bar.

Link copied to clipboard

Default tonal elevation for a search bar.

Link copied to clipboard
@get:Composable
val windowInsets: WindowInsets

Default window insets for a SearchBar.

Functions

Link copied to clipboard
@Composable
fun colors(containerColor: Color = SearchBarTokens.ContainerColor.value, dividerColor: Color = SearchViewTokens.DividerColor.value): SearchBarColors

Creates a SearchBarColors that represents the different colors used in parts of the search bar in different states.

@Composable
fun colors(containerColor: Color = SearchBarTokens.ContainerColor.value, dividerColor: Color = SearchViewTokens.DividerColor.value, inputFieldColors: TextFieldColors = inputFieldColors()): SearchBarColors
Link copied to clipboard
@Composable
fun InputField(query: String, onQueryChange: (String) -> Unit, onSearch: (String) -> Unit, expanded: Boolean, onExpandedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, placeholder: @Composable () -> Unit? = null, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, colors: TextFieldColors = inputFieldColors(), interactionSource: MutableInteractionSource? = null)

A text field to input a query in a search bar

Link copied to clipboard
@Composable
fun inputFieldColors(focusedTextColor: Color = SearchBarTokens.InputTextColor.value, unfocusedTextColor: Color = SearchBarTokens.InputTextColor.value, disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.value.copy( alpha = FilledTextFieldTokens.DisabledInputOpacity ), cursorColor: Color = FilledTextFieldTokens.CaretColor.value, selectionColors: TextSelectionColors = LocalTextSelectionColors.current, focusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.value, unfocusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.value, disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.value.copy( alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity ), focusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.value, unfocusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.value, disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.value.copy( alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity ), focusedPlaceholderColor: Color = SearchBarTokens.SupportingTextColor.value, unfocusedPlaceholderColor: Color = SearchBarTokens.SupportingTextColor.value, disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.value.copy( alpha = FilledTextFieldTokens.DisabledInputOpacity )): TextFieldColors

Creates a TextFieldColors that represents the different colors used in the search bar input field in different states.