KPSearchBar

fun KPSearchBar(value: String, style: SearchBarStyle, size: SearchBarSize, onValueChange: (String) -> Unit, onTrailingIconClick: () -> Unit, modifier: Modifier = Modifier, colors: TextFieldColors = style.searchBarColors, placeholder: String? = SEARCH_BAR_PLACEHOLDER, radius: KPSearchBarRadius = KPSearchBarRadius.Small, keyboardOptions: KeyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Text, imeAction = ImeAction.Search ), keyboardActions: KeyboardActions = KeyboardActions.Default, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

The KPSearchBar composable function creates a customizable search bar with various parameters.

Parameters

value

the input to be shown in the search bar

style

determines the style of the search bar. It can be either KPSearchBarStyle.Outline or KPSearchBarStyle.Filled

size

determines the size of the search bar. It can be either KPSearchBarSize.Small or KPSearchBarSize.Medium

onValueChange

the callback that is triggered when the input service updates values

onTrailingIconClick

the callback that is triggered when the trailing icon clicked in the search bar. An updated search bar value comes as a parameter of the callback

modifier

a Modifier for this search bar

colors

TextFieldColors that will be used to resolve color of the text and content (including placeholder, leading and trailing icons, border) for this search bar in different states. See KPSearchBarStyle

placeholder

the optional placeholder to be displayed when the search bar is in focus and the input text is empty. Default is "Ürün Ara"

radius

the radius to be applied to the search bar corners. Default is KPSearchBarRadius.Small

keyboardOptions

software keyboard options that contains configuration

keyboardActions

when the input service emits an IME action, the corresponding callback

interactionSource

the MutableInteractionSource representing the stream of interactions for this OutlinedTextField. You can create and pass in your own remembered MutableInteractionSource if you want to observe interactions and customize the appearance / behavior of this KPSearchBar in different interactions.