NepaliDatePicker

fun NepaliDatePicker(state: NepaliDatePickerState, modifier: Modifier = Modifier, title: @Composable () -> Unit? = { NepaliDatePickerDefaults.NepaliDatePickerTitle( modifier = Modifier.padding(NepaliDatePickerTitlePadding), language = state.locale.language, displayMode = state.displayMode, calendarSystem = state.displayedCalendarSystem ) }, headline: @Composable () -> Unit? = { NepaliDatePickerDefaults.NepaliDatePickerHeadline( selectedDate = state.selectedDate, modifier = Modifier.padding(NepaliDatePickerHeadlinePadding), locale = state.locale, displayMode = state.displayMode, selectedEnglishDate = state.selectedEnglishDate, calendarSystem = state.displayedCalendarSystem ) }, secondaryDateLocale: NepaliDateLocale? = null, showModeToggle: Boolean = true, showTodayButton: Boolean = true, showCalendarSystemToggle: Boolean = false, showAdjacentMonthDays: Boolean = false, colors: NepaliDatePickerColors = NepaliDatePickerDefaults.colors(), dayDecorator: NepaliDayDecorator? = null)(source)

Nepali Date Picker lets user select a date and preferably should be embedded into Dialogs. See NepaliDatePickerDialog.

Nepali date picker lets you pick a Nepali date via a calendar UI which displays Nepali date..

The grid can show either calendar. Pass a secondaryDateLocale to pair every day with its counterpart in the other calendar, and set showCalendarSystemToggle to let the user switch which calendar leads. Switching never changes the selection: a selected date is always held in Bikram Sambat, so the same day stays picked in both views. Both are off by default, so a picker that does not ask for them looks and behaves exactly as before.

Parameters

state

state of the date picker. See rememberNepaliDatePickerState.

modifier

the Modifier to be applied to this date picker

title

the title to be displayed in the date picker

headline

the headline to be displayed in the date picker

secondaryDateLocale

when non-null, every day cell also shows the same day in the other calendar, using this NepaliDateLocale for its language and digits. null shows one calendar only.

showModeToggle

the boolean to let user toggle between Date Picker and Date Input

showTodayButton

the boolean to control either to show TODAY button or not

showCalendarSystemToggle

the boolean to show the B.S. / A.D. switch, which drives NepaliDatePickerState.displayedCalendarSystem

showAdjacentMonthDays

the boolean to fill the grid's empty cells with the neighbouring months' days, drawn faded. Tapping one selects that day and moves the grid to its month. A day the picker cannot select, because of NepaliSelectableDates or the year range, stays faded and inert. Off by default, matching the Material3 DatePicker.

colors

NepaliDatePickerColors that will be used to resolve the colors used for this date picker in different states. See NepaliDatePickerDefaults.colors.

dayDecorator

marks days that carry a holiday, a festival or an app's own event, with dots under the day number and a color for the number itself. null, the default, leaves every day as the theme draws it. Selection and the disabled state always win over a decoration. See NepaliDatePickerDefaults.eventDecorator and NepaliDatePickerDefaults.dayDecorator.

Example usage:

val defaultNepaliDatePickerState = rememberNepaliDatePickerState()

NepaliDatePicker(state = defaultNepaliDatePickerState)

// Events coloured and dotted, from the provider the app already has
NepaliDatePicker(
state = rememberNepaliDatePickerState(),
dayDecorator = NepaliDatePickerDefaults.eventDecorator(provider = myEvents)
)

// Both calendars in every cell, and a switch for which one leads
NepaliDatePicker(
state = rememberNepaliDatePickerState(),
secondaryDateLocale = NepaliDatePickerDefaults.DefaultLocale,
showCalendarSystemToggle = true
)

// A full six-week grid, with the neighbouring months filling the edges
NepaliDatePicker(
state = rememberNepaliDatePickerState(),
showAdjacentMonthDays = true
)

See also