francisco
04/12/2023, 8:41 PMOutlinedTextfield
component.
My design system calls for custom type for the label
composable. I see in the TextFieldImpl
that the TextField
component animates between MaterialTheme.typography.bodyLarge
and MaterialTheme.typography.bodySmall
depending if the textfield is focused or not.
My question is, am i able to override these so that I could use my design system types? I have a specific font for bodySmall and bodyLarge, but not sure how to go about setting those if i’m not using the MaterialTheme
as my parent compose Theme
@Composable
@Preview
fun TextInputPreview() {
var text by remember {
mutableStateOf("")
}
TextField(
value = text,
onValueChange = { text = it },
label = {
Text(
"My label",
style = PedalTheme.typography.body // switch between bodySmall or bodyLarge
)
}
)
}
ProvideTextStyle
but i believe this is for just one type@Composable
fun TextInputWrapper() {
PedalTheme {
TextField(
value = "test",
onValueChange = { .. },
label = {
MaterialTheme(
typography = typography(bodyLarge = myTheme.bodyLarge, bodySmall = myTheme.bodySmall) {
Text(text = "my label")
}
}
}
}
Colton Idle
04/13/2023, 12:51 PM