API reference

SearchBar Composable

Displays a single-line query field with clear and optional voice actions.

Signature

@Composable
fun SearchBar(
    query: String,
    onQueryChange: (String) -> Unit,
    onSearch: (String) -> Unit,
    modifier: Modifier = Modifier,
    placeholder: String = stringResource(R.string.uiset_search_placeholder),
    onAudioClick: () -> Unit? = null,
    onClear: () -> Unit? = null,
    enabled: Boolean = true,
    autoCorrectEnabled: Boolean = false,
    capitalization: KeyboardCapitalization = KeyboardCapitalization.None,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    colors: InputColors = InputDefaults.Colors,
    dimensions: InputDimensions = UiSetTheme.dimensions.inputs,
    shape: Shape = UiSetTheme.shapes.textField,
)

Parameters

query: String current query text
onQueryChange: (String) -> Unit callback receiving text edits
onSearch: (String) -> Unit callback invoked by the keyboard search action
modifier: Modifier modifier applied to the full field
placeholder: String text shown for an empty query
onAudioClick: (() -> Unit)? optional voice-input action; the microphone remains available while typing
onClear: (() -> Unit)? optional callback invoked after onQueryChange clears the query
enabled: Boolean whether the field and actions accept input
autoCorrectEnabled: Boolean whether the keyboard may autocorrect the query
capitalization: KeyboardCapitalization keyboard capitalization behavior
keyboardType: KeyboardType requested software keyboard type
interactionSource: MutableInteractionSource interaction stream shared with callers observing field state
colors: InputColors container, content, focus, placeholder, and disabled colors
dimensions: InputDimensions field height, icon, padding, spacing, and border geometry
shape: Shape field container shape