fossui
Components

Calendar

A month grid for picking a single day, several days, or a date range.

A calendar shows one month at a time and lets a person pick dates from the grid. It comes in three shapes, one per named constructor: single for one day, multiple for a set of days, and range for a start-to-end span. Chevrons move between months, and the grid is fully operable from the keyboard.

Calendar
import 'package:fossui/fossui.dart';

FossCalendar.single(
  selected: _day,
  onSelected: (day) => setState(() => _day = day),
);

Multiple days

FossCalendar.multiple tracks a Set<DateTime>. Each tap toggles a day, and onSelected fires with the next set.

FossCalendar.multiple(
  selected: _days,
  onSelected: (days) => setState(() => _days = days),
);

Date range

FossCalendar.range selects a span over two taps. The first tap sets the start, the second sets the end, and onSelected fires with a FossDateRange.

Calendar range
FossCalendar.range(
  selected: _range,
  onSelected: (range) => setState(() => _range = range),
);

Bounds

minDate and maxDate cap the selectable span, and isDateEnabled disables individual days such as weekends or holidays.

FossCalendar.single(
  selected: _day,
  minDate: DateTime.now(),
  isDateEnabled: (day) => day.weekday <= DateTime.friday,
  onSelected: (day) => setState(() => _day = day),
);

Month and week layout

Pass initialMonth to open on a specific month, or focusedMonth with onMonthChanged to control the shown month. firstDayOfWeek sets the leading column, and showOutsideDays toggles the trailing days from adjacent months.

FossCalendar.single(
  selected: _day,
  firstDayOfWeek: DateTime.sunday,
  showOutsideDays: false,
  onSelected: (day) => setState(() => _day = day),
);

One-off styling

Global retheming is the first choice, but a single calendar can override its resolved colors, type, and cell geometry with a FossCalendarStyle. Every field is optional and falls back to the theme.

FossCalendar.single(
  selected: _day,
  style: const FossCalendarStyle(
    dayRadius: 6,
  ),
  onSelected: (day) => setState(() => _day = day),
);

API

FossCalendar.single

PropTypeDefaultDescription
selectedDateTime?requiredThe highlighted day, or null for none.
onSelectedValueChanged<DateTime>requiredFires with the tapped day.

FossCalendar.multiple

PropTypeDefaultDescription
selectedSet<DateTime>requiredThe set of highlighted days.
onSelectedValueChanged<Set<DateTime>>requiredFires with the next set as each day toggles.

FossCalendar.range

PropTypeDefaultDescription
selectedFossDateRange?requiredThe chosen span, or null for none.
onSelectedValueChanged<FossDateRange>requiredFires as the range is set over two taps.

Shared props

PropTypeDefaultDescription
initialMonthDateTime?nullMonth shown first when uncontrolled.
focusedMonthDateTime?nullControlled shown month; pair with onMonthChanged.
onMonthChangedValueChanged<DateTime>?nullFires when the shown month changes.
firstDayOfWeekintDateTime.mondayLeading column of the week (1 to 7).
showOutsideDaysbooltrueWhether adjacent-month days appear.
minDateDateTime?nullEarliest selectable day.
maxDateDateTime?nullLatest selectable day.
isDateEnabledbool Function(DateTime)?nullDisables individual days.
semanticsLabelString?nullAccessibility name for the grid.
styleFossCalendarStyle?nullPer-instance overrides on the theme.

Live demo

Open the interactive gallery to try single, multiple, and range modes with live knobs.

On this page