ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

feat: Dot indicator for individual calendar day in Datetime

Open sean-perkins opened this issue 3 years ago • 0 comments

Prerequisites

Describe the Feature Request

The datetime component should include options to optionally render a dot indicator for specific calendar days. To align with iOS design, at most one dot indicator can display at a time for a single calendar day. Displaying a dot should only be available for presentation="date" and presentation="date-time".

Dot indicators are not theme-able in the iOS interface, but I think it makes sense to allow developers to customize the appearance (background color).

Describe the Use Case

The iOS design for the calendar grid commonly shows a dot indicator on a calendar day to indicate either an event or additional information is available for a specific day.

Other libraries such as V-Calendar support this API: https://vcalendar.io/attributes.html#dots

Describe Preferred Solution

Datetime should accept a function that allows developers to control when a dot indicator is displayed.

<ion-datetime></ion-datetime>

<script>
  const datetime = document.querySelector('ion-datetime');
  datetime.displayDotForDate = (dateIsoString) => {
    const date = new Date(dateIsoString);
    // check for a specific date
    return true;
  }
</script>

The default behavior would be to not render a dot for a calendar day.

Developers can customize the appearance of the dot through CSS variables:

ion-datetime {
  --dot-background: blue;
}

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

sean-perkins avatar Aug 26 '22 03:08 sean-perkins