Pantrix UI

Date Filled Text Field

A filled text field for a day: the day is typed in digits, or chosen from a calendar that a button at the box's end opens. It is PantrixDateTextField in a filled box.

import com.pantrixui.components.date.datefilledtextfield.PantrixDateFilledTextField

Examples

A birthday

A birthday, in a filled box: a day after today is not taken. The label moves up as the field takes the focus, and the pattern shows.

var birthday by remember { mutableStateOf<PantrixDate?>(null) }
PantrixDateFilledTextField(
    value = birthday,
    onValueChange = { birthday = it },
    label = "Birthday",
    maxDate = rememberToday(),
    showClearButton = true,
    tagKey = "birthday"
)

The calendar in a dialog

A delivery day on a weekday; the calendar opens in a dialog in the middle of the window.

var delivery by remember { mutableStateOf<PantrixDate?>(null) }
val today = rememberToday()
PantrixDateFilledTextField(
    value = delivery,
    onValueChange = { delivery = it },
    label = "Delivery day",
    minDate = today.plusDays(1),
    maxDate = today.plusMonths(1),
    isDateEnabled = { it.dayOfWeek <= FRIDAY },
    presentation = DatePickerPresentation.Dialog,
    tagKey = "delivery"
)

private const val FRIDAY = 5

The app's error and disabled

The app's error and a disabled field, in a filled box.

var meeting by remember { mutableStateOf<PantrixDate?>(PantrixDate(2026, 11, 2)) }
val taken = meeting == PantrixDate(2026, 11, 2)
PantrixDateFilledTextField(
    value = meeting,
    onValueChange = { meeting = it },
    label = "Meeting day",
    supportingText = if (taken) "This day is taken, choose another" else "A day the office is open",
    error = taken,
    tagKey = "meeting"
)
PantrixDateFilledTextField(
    value = PantrixDate(2026, 10, 1),
    onValueChange = {},
    enabled = false,
    label = "Contract start",
    tagKey = "contract"
)

Bound to a form

Bound to a form's field, in a filled box: with no day, "Save" shows the error.

val form = rememberFormState()
val scope = rememberCoroutineScope()
val report = LocalExampleEvents.current
val start = form.field<PantrixDate?>("start", initial = null, Rules.required("Enter the start day"))
PantrixDateFilledTextField(
    field = start,
    modifier = Modifier.fillMaxWidth(),
    form = form,
    label = "Start day",
    minDate = rememberToday()
)
PantrixButton(
    text = "Save",
    onClick = { scope.launch { form.submit { report("Saved") } } },
    form = form,
    tagKey = "save_start"
)

On a state

On a state: state.date is the field's day, state.text the digits typed. Together they tell an empty field from a half-typed one. The button changes the state's day, and the field writes it in itself.

val state = rememberDateTextFieldState()
val today = rememberToday()
Column(verticalArrangement = Arrangement.spacedBy(PantrixTheme.spacing.sm)) {
    PantrixDateFilledTextField(
        state = state,
        label = "Report day",
        tagKey = "report_day"
    )
    PantrixText(
        text = when {
            state.date != null -> "Day: ${state.date}"
            state.text.isEmpty() -> "The field is empty"
            else -> "Half typed: ${state.text}"
        },
        style = PantrixTheme.typography.body
    )
    PantrixButton(
        text = "Write today",
        onClick = { state.date = today },
        variant = ButtonVariant.Outline,
        tagKey = "write_today"
    )
}

API

value

A filled text field for a day: the day is typed in digits, or chosen from a calendar that a button at the box's end opens. It is PantrixDateTextField in a filled box.

ParameterTypeDefaultWhat it is
valuePantrixDate?the day the field shows, or null.
onValueChange(PantrixDate?) -> Unittold the field's day each time the user changes it: a day, or null for none.
modifierModifierModifierthe modifier of the whole field: its label, its box and what is under it.
enabledBooleantruewhether the field can be used. One that cannot takes no focus and opens no calendar.
readOnlyBooleanfalsewhether the day can only be chosen from the calendar, and not typed.
labelString?nullwhat the field is for, inside the box: the field's name for a screen reader, and its calendar's.
placeholderString?nullshown in the box while it is empty, in the place of the pattern the field shows by itself.
supportingTextString?nullhelp under the box. With error it is the message that says what to put right; without it, the field's own error takes its place while there is one.
errorBooleanfalsewhether the caller finds the day wrong, as a day already taken: the field is drawn in error, and supportingText is the message.
leadingIcon(@Composable () -> Unit)?nullwhat stands before the text. A slot does not size what is put in it.
showClearButtonBooleanfalseshows a button that empties the field, while it can be typed into and is not empty.
minDatePantrixDate?nullthe first day the field takes, or null for no first. Not after maxDate.
maxDatePantrixDate?nullthe last day the field takes, or null for no last.
isDateEnabled((PantrixDate) -> Boolean)?nullwhether the field takes a day between the two, or null for every day: a weekday, a day not yet booked.
firstDayOfWeekInt?nullthe day the calendar's weeks start on, 1 for Monday to 7 for Sunday as ISO 8601 numbers them, or null for the language's.
todayPantrixDaterememberToday()the day the calendar marks as today: by default the one the screen's clock shows (rememberToday), which turns at midnight.
formatDateFieldFormatDateFieldFormat.of(PantrixTheme.locale)the order the parts are typed in and the mark between them: the theme's language's and region's by default. of: The role of the theme this tone is drawn in.
presentationDatePickerPresentationDatePickerPresentation.Adaptivewhat the calendar opens in: by default a sheet in a narrow window and a popover under the box in a wider one, chosen as it opens; or always a popover, a sheet or a dialog.
styleFilledTextFieldStyle?nullthis call's own style of the field: over every enclosing one and under the density.
colorsFilledTextFieldColors?nullthis call's own colours of the field, in place of the theme's roles.
pickerStyleDatePickerStyle?nullthis call's own style of the calendar.
pickerColorsDatePickerColors?nullthis call's own colours of the calendar.
contentDescriptionString?nullwhat a screen reader says for the field where it has no label.
tagKeyString?nullthe field's automation key: the field is DateFilledTextField_<tagKey>, its button DateFilledTextFieldCalendar_<tagKey>, its clear button DateFilledTextFieldClear_<tagKey> and its calendar DatePicker_<tagKey>. The field reports that the calendar opened and that a day was chosen in it, and never the day.
interactionSourceMutableInteractionSource?nullthe field's interactions, hoisted: its focus, its hover and its presses.

state

A date field on a state its caller keeps, as PantrixDateFilledTextField of a value is in every other way: the state's date is the field's day, setting it writes the day in, and its text tells a field that is half typed from an empty one.

ParameterTypeDefaultWhat it is
stateDateTextFieldStatethe digits typed and the day they make. Create it with rememberDateTextFieldState().
modifierModifierModifierthe modifier of the whole field: its label, its box and what is under it.
enabledBooleantruewhether the field can be used. One that cannot takes no focus and opens no calendar.
readOnlyBooleanfalsewhether the day can only be chosen from the calendar, and not typed.
labelString?nullwhat the field is for, inside the box: the field's name for a screen reader, and its calendar's.
placeholderString?nullshown in the box while it is empty, in the place of the pattern the field shows by itself.
supportingTextString?nullhelp under the box. With error it is the message; without it, the field's own error takes its place while there is one.
errorBooleanfalsewhether the caller finds the day wrong: the field is drawn in error, and supportingText is the message.
leadingIcon(@Composable () -> Unit)?nullwhat stands before the text.
showClearButtonBooleanfalseshows a button that empties the field, while it can be typed into and is not empty.
minDatePantrixDate?nullthe first day the field takes, or null for no first. Not after maxDate.
maxDatePantrixDate?nullthe last day the field takes, or null for no last.
isDateEnabled((PantrixDate) -> Boolean)?nullwhether the field takes a day between the two, or null for every day.
firstDayOfWeekInt?nullthe day the calendar's weeks start on, 1 for Monday to 7 for Sunday, or null for the language's.
todayPantrixDaterememberToday()the day the calendar marks as today: by default the one the screen's clock shows (rememberToday).
formatDateFieldFormatDateFieldFormat.of(PantrixTheme.locale)the order the parts are typed in and the mark between them: the theme's locale's by default. of: The role of the theme this tone is drawn in.
presentationDatePickerPresentationDatePickerPresentation.Adaptivewhat the calendar opens in: by default a sheet in a narrow window and a popover under the box in a wider one, chosen as it opens; or always a popover, a sheet or a dialog.
styleFilledTextFieldStyle?nullthis call's own style of the field.
colorsFilledTextFieldColors?nullthis call's own colours of the field.
pickerStyleDatePickerStyle?nullthis call's own style of the calendar.
pickerColorsDatePickerColors?nullthis call's own colours of the calendar.
contentDescriptionString?nullwhat a screen reader says for the field where it has no label.
tagKeyString?nullthe field's automation key, as PantrixDateFilledTextField of a value takes it.
interactionSourceMutableInteractionSource?nullthe field's interactions, hoisted.

field

A date field bound to a form's field: its day, its error and its name come from field.

ParameterTypeDefaultWhat it is
fieldFormField<PantrixDate?>the form's field the date field shows and changes.
modifierModifierModifierthe modifier of the whole field.
formFormState?nullgiven, the keyboard's action key submits the form through the button registered with it.
enabledBooleantruewhether the field can be used.
readOnlyBooleanfalsewhether the day can only be chosen from the calendar.
labelString?nullwhat the field is for, inside the box.
placeholderString?nullshown in the box while it is empty, in the place of the pattern.
supportingTextString?nullhelp under the box, while the field has no error to show there.
leadingIcon(@Composable () -> Unit)?nullwhat stands before the text.
showClearButtonBooleanfalseshows a button that empties the field, while it can be typed into and is not empty.
minDatePantrixDate?nullthe first day the field takes, or null for no first. Not after maxDate.
maxDatePantrixDate?nullthe last day the field takes, or null for no last.
isDateEnabled((PantrixDate) -> Boolean)?nullwhether the field takes a day between the two, or null for every day.
firstDayOfWeekInt?nullthe day the calendar's weeks start on, 1 for Monday to 7 for Sunday, or null for the language's.
todayPantrixDaterememberToday()the day the calendar marks as today: by default the one the screen's clock shows (rememberToday).
formatDateFieldFormatDateFieldFormat.of(PantrixTheme.locale)the order the parts are typed in and the mark between them: the theme's locale's by default. of: The role of the theme this tone is drawn in.
presentationDatePickerPresentationDatePickerPresentation.Adaptivewhat the calendar opens in: by default a sheet in a narrow window and a popover under the box in a wider one, chosen as it opens; or always a popover, a sheet or a dialog.
styleFilledTextFieldStyle?nullthis call's own style of the field.
colorsFilledTextFieldColors?nullthis call's own colours of the field.
pickerStyleDatePickerStyle?nullthis call's own style of the calendar.
pickerColorsDatePickerColors?nullthis call's own colours of the calendar.
contentDescriptionString?nullwhat a screen reader says for the field where it has no label.
interactionSourceMutableInteractionSource?nullthe field's interactions, hoisted.

FilledTextFieldStyle

PantrixFilledTextField's box: its shape, how tall and how wide it is at the least, the room around what it holds, its icons and its outline.

ParameterTypeDefaultWhat it is
shapeShapeSpecShapeSpec.UnspecifiedThe box's shape. A fully round one, ShapeRole.Full, is a pill only while the field holds one line: a field of several lines takes ShapeRole.Large instead, since a capsule's curve runs into the first line of its text.
heightDpDp.UnspecifiedThe least the box is tall.
minWidthDpDp.UnspecifiedThe least the box is wide, which keeps an empty field from growing as the user types into it.
horizontalPaddingDpDp.UnspecifiedThe room between the box's edge and its label and text, where no icon is.
verticalPaddingDpDp.UnspecifiedThe room above the label's line and below the last line of the text.
iconPaddingDpDp.UnspecifiedThe room around an icon in its slot.
iconSizeDpDp.UnspecifiedThe size an icon in a slot should take. A slot does not size what is put in it.
borderWidthDpDp.UnspecifiedHow thick the outline is that the box takes with the focus, in error and under a pointer. At rest it has none.
textRoleTypeRole?nullThe role of the type scale the text is typed in, the label rests in and the placeholder is set in: the body's, 16sp, on Android and iOS, as Material 3 types a field, and the label's, 14sp, on the desktop and the web, as a page under a pointer does.

FilledTextFieldColors

What PantrixFilledTextField is painted with, for a field that does not take the theme's: a colour that is set is used, and one that is left out stays the theme's role. A product gives the colours it changes and no others:

ParameterTypeDefaultWhat it is
containerColorColor.UnspecifiedThe box's fill at rest. The theme's neutral container.
focusedContainerColorColor.UnspecifiedThe box's fill under an outline: with the focus, and in error. The theme's surface.
hoveredOutlineColorColor.UnspecifiedThe outline under a pointer. The theme's borderHover.
focusedOutlineColorColor.UnspecifiedThe outline while the field has the focus. The theme's primary.
errorColorColor.UnspecifiedWhat says the text is wrong: the outline, the message under the box, the caret, and the count once it is past its limit. The theme's danger.
textColorColor.UnspecifiedThe typed text. The theme's textPrimary.
labelColorColor.UnspecifiedThe label, at rest in the text's place and on its own line above the text. The theme's textSecondary.
placeholderColorColor.UnspecifiedThe placeholder. The theme's textSecondary.
supportingTextColorColor.UnspecifiedThe help under the box, and the count. The theme's textSecondary.
iconColorColor.UnspecifiedWhat an icon in a slot is drawn in unless it sets a tint of its own, and the clear button's cross. The theme's textSecondary.
cursorColorColor.UnspecifiedThe caret, and with it the handles and the highlight of a selection. The theme's primary.
scrollBarColorColor.UnspecifiedThe bar that shows how far the text of a box of several lines is scrolled. The theme's borderStrong: it is a mark on the box's fill, and a box's soft edge would not be seen there.