Kotlin Android library for displaying weekly schedules and timetables using Jetpack Compose.
Initially created for Schedule Deluxe, this library provides a flexible week view component for calendar apps, timetables, and schedule management.
| University | Work | School | Conference (3-day) |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
- Jetpack Compose implementation (Compose-only since 3.0)
- Two layouts: a calendar timeline, or a school timetable of fixed periods
- Three event types: timed, all-day, and multi-day (spanning bars)
- Automatic overlap handling for concurrent events
- Pinch-to-zoom that keeps the time under your fingers in place
- Current time indicator and day highlighting
- Configurable event display, spacing, and time range
- Flexible day counts (3-day, 5-day, 7-day, etc.)
- Navigation handled externally for full control (e.g.
HorizontalPager, buttons) - Ships a baseline profile, so scrolling and zooming are smooth from the first launch
@Composable fun MyWeekView(events: List<Event>) { val dateRange = LocalDateRange( LocalDate.now().with(DayOfWeek.MONDAY), LocalDate.now().with(DayOfWeek.FRIDAY), ) val weekData = remember(events) { WeekData(dateRange, LocalTime.of(8, 0), LocalTime.of(18, 0), events) } WeekView( weekData = weekData, weekViewConfig = WeekViewConfig(), eventConfig = EventConfig(), actions = WeekViewActions( onEventClick = { event -> /* Handle click */ }, onEventLongPress = { event -> /* Handle long press */ }, ), ) }
// Timed event val meeting = Event.Single( id = "1", date = LocalDate.of(2026, 1, 15), title = "Team Meeting", shortTitle = "Meeting", timeSpan = TimeSpan.of(LocalTime.of(10, 0), Duration.ofHours(1)), backgroundColor = Color.Blue, textColor = Color.White, ) // All-day event val holiday = Event.AllDay( id = "2", date = LocalDate.of(2026, 1, 16), title = "National Holiday", shortTitle = "Holiday", backgroundColor = Color.Green, textColor = Color.White, ) // Multi-day event (renders as a spanning bar) val conference = Event.MultiDay( id = "3", date = LocalDate.of(2026, 1, 20), title = "Tech Conference", shortTitle = "Conf", lastDate = LocalDate.of(2026, 1, 22), backgroundColor = Color.Magenta, textColor = Color.White, ) val weekData = WeekData(dateRange, LocalTime.of(8, 0), LocalTime.of(18, 0), listOf(meeting, holiday, conference))
WeekData is immutable: to change what the week view shows, pass a new instance. Timed events outside the given time range widen the visible hours.
Event IDs must be unique across all event types in a WeekData. If your events come from several sources (for example two database tables with their own auto-increment keys), prefix the IDs, e.g. "lesson-12" and "holiday-12".
By default the week view is a calendar: rows are hours and every entry is as tall as it lasts.
Pass WeekLayout.Periods to show a school timetable instead, with one row per period and
all lessons equally tall:
val periods = listOf( Period("1", TimeSpan(LocalTime.of(8, 0), LocalTime.of(8, 45))), Period("2", TimeSpan(LocalTime.of(8, 50), LocalTime.of(9, 35))), Period("Break", TimeSpan(LocalTime.of(9, 35), LocalTime.of(9, 55)), isBreak = true), Period("3", TimeSpan(LocalTime.of(9, 55), LocalTime.of(10, 40))), ) WeekView( weekData = weekData, weekViewConfig = WeekViewConfig(), layout = WeekLayout.Periods(periods), actions = WeekViewActions( onEmptyPeriodClick = { date, period -> /* e.g. add a lesson here */ }, ), )
- Events stay ordinary
Event.Singles with their real times. Each one fills every period it overlaps, so a double lesson covers two rows and a lesson starting a few minutes late still fills its row. An event that overlaps no period goes to the nearest one rather than disappearing. - Breaks (
isBreak = true) are optional thin rows with their label across the week. Gaps between periods without a break row are simply left out. - The axis shows each period's label, plus its start and end time (
showTimes = falsehides them). - Lessons grow to fill the viewport and zoom with a pinch;
periodHeightandbreakHeightset their base size.scrollToTimeand the current-time line work as on the timeline. - There are no grid lines: every empty lesson cell shows a dashed placeholder in
gridLineColorinstead, andonEmptyPeriodClickmakes the placeholders clickable. - Since the axis already shows each period's times, consider
EventConfig(showTimeStart = false, showTimeEnd = false): the lessons then show their name and room centred in the cell. - Break rows are tinted with
breakBackgroundfromWeekViewDefaults.colors().
val weekViewConfig = WeekViewConfig( scalingFactor = 1.2f, showCurrentTimeIndicator = true, highlightCurrentDay = true, )
The week view takes its colors from the current MaterialTheme, so it follows light and dark mode.
Override single colors with WeekViewDefaults.colors():
WeekView( weekData = weekData, weekViewConfig = WeekViewConfig(), colors = WeekViewDefaults.colors(gridLineColor = Color.LightGray), )
val eventConfig = EventConfig( showSubtitle = true, showTimeStart = true, showTimeEnd = true, eventSpacingDp = 1, // gap between adjacent events (0 to disable) )
Events adapt their layout to the available height automatically, dropping fields by priority (name > start time > end time > location > teacher) rather than clipping whatever renders first. The decision uses the real line heights, so it stays correct under any system font scale:
- The name is always shown and shrinks to fit when the entry is very low or narrow.
- Start and end time are never combined into one line (that does not fit a five-day phone column). When the entry is tall enough they are stacked with the name - start above, end pinned to the bottom right; when it isn't, they move into the top-left and bottom-right corners as smaller labels, keeping only the start time once both would crowd out the name; only very low entries drop them entirely. Labels that don't fit a narrow overlap column even at their smallest size are hidden rather than clipped.
- Location and teacher are added back in as the entry gets taller.
- The title wraps onto a second line instead of eliding once there's room to spare.
- Without a start time above the title (e.g.
showTimeStart = false) the fields are centred vertically in the entry instead of starting at the top.
Pass eventContent to replace how timed entries look. The week view still positions and
sizes each entry, handles clicks and sets its accessibility description; the slot only
draws inside it, including the background and shape. EventContentScope provides the
event, the entry's width and height, the EventConfig and the locale.
WeekView( weekData = weekData, weekViewConfig = WeekViewConfig(), eventContent = { scope -> Box( Modifier .fillMaxSize() .background(scope.event.backgroundColor, RoundedCornerShape(8.dp)) .padding(4.dp), ) { Text(scope.event.title) } }, )
The library ships three ready-made styles. All of them fit the fields to the entry height as described above; they only differ in container and colors:
| Style | Look |
|---|---|
FilledEventContent (default) |
Filled with the event's background color, text in its text color |
TintedEventContent |
Light tint of the event color with a full-color bar on the left |
OutlinedEventContent |
Theme surface with a border in the event color |
WeekView( weekData = weekData, weekViewConfig = WeekViewConfig(), eventContent = { TintedEventContent(it) }, )
Built-in styles can also be mixed with your own, e.g. a custom design for some events only. All-day and multi-day events are not affected.
rememberWeekViewState keeps the zoom level and scroll position across rotation and process death.
Pass initialTime to open the week view at a given time, and scroll there later with
scrollToTime or animateScrollToTime:
val state = rememberWeekViewState(initialTime = LocalTime.of(8, 0)) val scope = rememberCoroutineScope() WeekView(weekData = weekData, weekViewConfig = WeekViewConfig(), state = state) Button(onClick = { scope.launch { state.animateScrollToTime(LocalTime.now()) } }) { Text("Now") }
Pinch-zooming keeps the time under the fingers in place.
val actions = WeekViewActions( onEventClick = { event -> /* Handle event tap */ }, onEventLongPress = { event -> /* Handle long press */ }, onScalingFactorChange = { factor -> /* Persist zoom level */ }, onDayClick = { date -> /* Handle day header tap */ }, onEmptyPeriodClick = { date, period -> /* Empty lesson cell tapped (WeekLayout.Periods only) */ }, )
In your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
// ... other repositories
maven { url = uri("https://jitpack.io") }
}
}In your app build.gradle.kts, replacing <version> with the latest release shown by the JitPack badge above:
dependencies {
implementation("com.github.tobiasschuerg:android-week-view:<version>")
// Required for Compose
implementation(platform("androidx.compose:compose-bom:<compose-bom-version>"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")
}Changes for each version are listed on the GitHub Releases page.
The app/ module contains a sample app with five built-in timetables (University, Work, School, Conference, Special Cases) demonstrating different layouts, overlapping events, all-day/multi-day events, a 3-day view, and rendering edge cases like very short entries and long titles. Switch between them via the top app bar menu.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Run
./gradlew ktlintFormatbefore committing - Add tests for new functionality
- Submit a pull request
- JitPack: https://jitpack.io/#tobiasschuerg/android-week-view
- Sample App: See
app/module in this repository - Issues: https://github.com/tobiasschuerg/android-week-view/issues



