I'm using the SearchBar
included in the Compose library with Material3: androidx.compose.material3.SearchBar
.
(Question 1) I'm trying to customize it a bit and I don't know how to set custom font for the typing text. However I can set a custom font for the placeholder text.
SearchBar(
modifier = Modifier.fillMaxWidth(),
placeholder = {
Text(
text = searchPlaceHolder,
style = MaterialTheme.typography.h4, //my custom style - font
color = Color.Gray
)
},
(...)
)
(Question 2) Moreover, I don't know how to modify the height of the SearchBar
or reduce the paddings to center the placeholder text.
(Question 1) Single way that I found is:
Under the hood SearchBar uses BasicTextField that has his style set as LocalTextStyle.current
Would be nice to know if someone else found a better approach.
(Question 2) This one didn't find a way to change it yet, SearchBar uses BasicTextField where height is hardcoded to InputFieldHeight that is a val and can't be modfied