Compose Component

TimeText

Layout to show the current time and a label, they will be drawn in a curve, following the top edge of the screen.

TimeText social preview

TimeTextClockOnly

@Sampled
@Composable
fun TimeTextClockOnly() {
    // TimeText displays the current time by default.
    TimeText()
}

TimeTextWithStatus

@Sampled
@Composable
fun TimeTextWithStatus() {
    val style = TimeTextDefaults.timeTextStyle()
    val primaryStyle = TimeTextDefaults.timeTextStyle(color = MaterialTheme.colorScheme.primary)
    TimeText { time ->
        timeTextCurvedText("ETA 12:48", style = primaryStyle)
        timeTextSeparator(style)
        timeTextCurvedText(time)
    }
}

TimeTextWithStatusEllipsized

@Sampled
@Composable
fun TimeTextWithStatusEllipsized() {
    val style = TimeTextDefaults.timeTextStyle()
    TimeText { time ->
        curvedText(
            "Long status that should be ellipsized.",
            CurvedModifier.weight(1f),
            overflow = TextOverflow.Ellipsis,
        )
        timeTextSeparator(style)
        timeTextCurvedText(time)
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: