← All libraries

SugarCalendar

SugarCalendar

Interactive date picker

port of EthanEFung/bubble-datepicker datepickercalendarinput

Month-grid date picker with keyboard navigation, min/max date constraints, locale-aware day names, and a fully-rendered ANSI view.

Install

composer require sugarcraft/sugar-calendar

Quickstart

use SugarCraft\Calendar\DatePicker;

$picker = DatePicker::new(new \DateTimeImmutable('2026-01-01'));
$picker = $picker->withMinDate(new \DateTimeImmutable('2025-01-01'));
$picker = $picker->withMaxDate(new \DateTimeImmutable('2027-12-31'));

echo $picker->view();  // renders month grid

What's in the box

Month gridFull month view with day letters, today highlight, cursor.
Keyboard navArrow keys, Enter to select, Esc to cancel.
Min / Max constraintsRestrict selectable date range.
Locale supportCustom day/month names via configuration.

Source & demos

Try the quickstart →

API

ClassMethodDescription
DatePickernew(date)Create date picker
DatePickerwithMinDate(date)Set minimum selectable date
DatePickerwithMaxDate(date)Set maximum selectable date
DatePickerview()Render calendar view
DatePickerselected()Get selected date

Demos.

VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.

May / June 2026

May / June 2026

Month-grid datepicker with cursor and selected day.
Min / max constraints

Min / max constraints

Same picker bounded between two dates.