NepaliCalendar

fun NepaliCalendar(state: NepaliCalendarState, modifier: Modifier = Modifier, policy: NepaliCalendarPolicy = NepaliCalendarPolicy.Default, secondaryDateLocale: NepaliDateLocale? = NepaliDatePickerDefaults.DefaultLocale, showTodayButton: Boolean = true, showCalendarSystemToggle: Boolean = false, showAdjacentMonthDays: Boolean = true, colors: NepaliDatePickerColors = NepaliDatePickerDefaults.colors(), markerColors: NepaliDayMarkerColors = NepaliDatePickerDefaults.markerColors(), eventDisplayStyle: NepaliEventDisplayStyle = NepaliEventDisplayStyle.Default, dayDecorator: NepaliDayDecorator? = null, onDayClick: (day: CustomCalendar, status: NepaliDayStatus) -> Unit? = null)(source)

A browsable month calendar: a wall patro that fills the width it is given, pages month by month, and names the days an institution is closed for.

Unlike NepaliDatePicker, which asks for a date and is sized for a dialog, this fills its container and shows both calendars' numbers by default, which is how a Nepali calendar is read. It draws at a fixed height, six week rows whatever the month's shape, and never scrolls vertically, so it sits as one block inside a screen's own scrolling content. Give it a bounded width; an unbounded one, a horizontal scroller or a Row without a weight, has nothing for the month pager to fill.

Events are first-class here: policy decides which days are closed and what is named on them, and the grid marks them without any further wiring. The policy is read once per visible month rather than once per day, so a provider answering from a memoized source keeps paging cheap. Pair the calendar with NepaliMonthEventList and NepaliDaySummary over the same state and policy to write those days out.

Parameters

state

what is shown and what is picked. See rememberNepaliCalendarState.

modifier

the Modifier applied to the calendar.

policy

the institution the calendar describes: the days of the week it never opens, and the events it keeps. Defaults to Nepal's usual office week, Saturday off, with no events.

secondaryDateLocale

pairs every cell with the same day in the other calendar, in this locale's language and digits. On by default, since a Nepali calendar is usually read against the Gregorian one; pass null for a single number per cell.

showTodayButton

whether the header offers a button back to today's month.

showCalendarSystemToggle

whether the header carries the B.S. / A.D. switch, which drives NepaliCalendarState.displayedCalendarSystem.

showAdjacentMonthDays

whether the empty slots around the month are filled with its neighbours' days, drawn faded. On by default, which is what makes the grid read as a wall calendar. Tapping one picks that day and moves the calendar to its month.

colors

the NepaliDatePickerColors the calendar themes itself from.

markerColors

the palette a marked day is drawn in, one slot per kind of event.

eventDisplayStyle

how much of a day's status is drawn: its colour, its dots, its disc, and what a screen reader is told.

dayDecorator

an app's own marks, laid over the policy's. The policy's colour leads and the dots of both are drawn, so a public holiday that also carries two meetings keeps the holiday's colour and gains the meetings' dots. Hoist it in a remember, as NepaliDayDecorator asks.

onDayClick

invoked after a tapped day becomes the selection, with the day and what policy says about it. A day with no Bikram Sambat date, which only happens before the conversion anchor, is inert and never calls this.

Example usage:

val state = rememberNepaliCalendarState()
val policy = remember { NepaliCalendarPolicy(provider = myEvents) }

LazyColumn {
item { NepaliCalendar(state = state, policy = policy) }
item { NepaliDaySummary(state = state, policy = policy) }
item { NepaliMonthEventList(state = state, policy = policy) }
}

See also