Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to display the label of an OutlinedTextField constantly in Material 3 in Jetpack Compose for Android. You can use the Label parameter of the OutlinedTextField component to define a label that is always visible, regardless of whether there is text in the field or not. Here's an example:

OutlinedTextField(
    value = text,
    onValueChange = { newText -> text = newText },
    label = { Text("Username") }, // define the label here
    modifier = Modifier
        .fillMaxWidth()
        .padding(16.dp)
)

In this example, the label of the OutlinedTextField will always be "Username", regardless of whether there is any text in the field. You can customize the label text and style as desired using the Text component.