Package 

Interface SearchBoxState

  • All Implemented Interfaces:
    com.algolia.instantsearch.core.searchbox.SearchBoxView

    
    public interface SearchBoxState
     implements SearchBoxView
                        

    Search box query component for compose.

    Example using SearchBoxState with material's TextField:

    @Composable
    public fun SearchBox(
        searchBoxState: SearchBoxState
    ) {
        TextField(
            // set query as text value
            value = searchBoxState.query,
            // update text on value change
            onValueChange = { searchBoxState.setText(it) },
    
            // set ime action to "search"
            keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
            // set text as query submit on search action
            keyboardActions = KeyboardActions(
                onSearch = { searchBoxState.setText(searchBoxState.query, true)}
            )
        )
    }