Skip to content

feat(calendar): add day template - #17846

Open
teodosiah wants to merge 8 commits into
masterfrom
thristodorova/feat-17822-calendar-day-template
Open

teodosiah wants to merge 8 commits into
masterfrom
thristodorova/feat-17822-calendar-day-template

Conversation

@teodosiah

Copy link
Copy Markdown
Contributor

Closes #17822

Description

Add the igxCalendarDay directive and the dayTemplate input to customize the content of the calendar day cells. The template receives the date and the day states through IgxCalendarDayTemplateContext, while the cells keep their selection, keyboard navigation, ARIA and styling. The date picker and date range picker pass the template to their calendar.

Motivation / Context

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant labels have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Add the igxCalendarDay directive and the dayTemplate input to customize
the content of the calendar day cells. The template receives the date
and the day states through IgxCalendarDayTemplateContext, while the
cells keep their selection, keyboard navigation, ARIA and styling.
The date picker and date range picker pass the template to their
calendar.

Closes #17822

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 11:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Template context values need correction, and both picker import collections must expose the new directive.

3 open issues
What changed in this PR

Adds customizable calendar day content for #17822, with typed date and state context and integration into both date pickers.

Changes:

  • Introduces igxCalendarDay and dayTemplate while retaining existing cell interaction and styling.
  • Adds calendar behavior tests and picker integration tests.
  • Documents the API and adds event-indicator and pricing samples.
File Description
src/​app/​calendar/​calendar.sample.ts Adds template directive imports and sample data helpers.
src/​app/​calendar/​calendar.sample.scss Styles event indicators and prices.
src/​app/​calendar/​calendar.sample.html Demonstrates calendar and range-picker templates.
skills/​igniteui-angular-components/​references/​form-controls.md Documents template usage and constraints.
projects/​igniteui-angular/​date-picker/​src/​date-range-picker/​date-range-picker.component.ts Forwards projected day templates to the calendar.
projects/​igniteui-angular/​date-picker/​src/​date-range-picker/​date-range-picker.component.spec.ts Tests range-picker template rendering.
projects/​igniteui-angular/​date-picker/​src/​date-picker/​date-picker.component.ts Forwards projected day templates to the calendar.
projects/​igniteui-angular/​date-picker/​src/​date-picker/​date-picker.component.spec.ts Tests date-picker template rendering.
projects/​igniteui-angular/​calendar/​src/​calendar/​public_api.ts Adds the directive to the calendar import collection.
projects/​igniteui-angular/​calendar/​src/​calendar/​days-view/​days-view.component.ts Accepts a typed day template.
projects/​igniteui-angular/​calendar/​src/​calendar/​days-view/​days-view.component.html Renders custom content for visible days.
projects/​igniteui-angular/​calendar/​src/​calendar/​days-view/​day-item.component.ts Builds the date and state context.
projects/​igniteui-angular/​calendar/​src/​calendar/​calendar.directives.ts Defines the directive and typed context.
projects/​igniteui-angular/​calendar/​src/​calendar/​calendar.component.ts Resolves input and projected templates.
projects/​igniteui-angular/​calendar/​src/​calendar/​calendar.component.spec.ts Tests context, interaction, precedence, and multiple views.
projects/​igniteui-angular/​calendar/​src/​calendar/​calendar.component.html Passes the template to each days view.
projects/​igniteui-angular/​calendar/​README.md Documents the API, context, and accessibility constraints.
CHANGELOG.md Announces day-template support.

Review effort: Balanced

Comment thread projects/igniteui-angular/calendar/src/calendar/days-view/day-item.component.ts Outdated
Comment thread projects/igniteui-angular/calendar/src/calendar/days-view/day-item.component.ts Outdated
Comment thread projects/igniteui-angular/date-picker/src/date-picker/date-picker.component.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Projected day templates can become stale while a picker is open, and meaningful custom day content is unavailable to screen-reader users.

3 open issues

Review effort: Balanced

Comment thread projects/igniteui-angular/date-picker/src/date-picker/date-picker.component.ts Outdated
teodosiah and others added 3 commits October 28, 2026 13:52
Announce the day template text as the day cell description through
aria-describedby, and pass projected igxCalendarDay template changes
to the calendar of an open date picker or date range picker.
Reuse the day template context without extra allocations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@mddragnev mddragnev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also update the Specification of the calendar,date/date-range pickers?

private subheaderTemplateDirective!: IgxCalendarSubheaderTemplateDirective;

/**
* @hidden

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hidden @internal not needed for private members

@ContentChild(IgxCalendarSubheaderTemplateDirective)
private subheaderTemplate!: IgxCalendarSubheaderTemplateDirective;

/** @hidden @internal */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@ContentChild(IgxCalendarSubheaderTemplateDirective)
private subheaderTemplate!: IgxCalendarSubheaderTemplateDirective;

/** @hidden @internal */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

*/
@Directive({
selector: '[igxCalendarDay]',
standalone: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. Now standalone defaults to true

* @hidden
* @internal
*/
@ContentChild(forwardRef(() => IgxCalendarDayTemplateDirective), { read: TemplateRef })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason for the forwardRef?

* @internal
*/
@ContentChild(forwardRef(() => IgxCalendarDayTemplateDirective), { read: TemplateRef })
private dayTemplateDirective?: TemplateRef<IgxCalendarDayTemplateContext>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming is ambiguous since the type of the dayTemplateDirective is a TemplateRef not the directive itself.


public set dayTemplate(value: TemplateRef<IgxCalendarDayTemplateContext> | null) {
this._dayTemplate = value;
this.cdr?.markForCheck();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need scheduling a CD in the setter?

const context = this._templateContext;
const disabled = this.isDisabled;

context.$implicit = context.date = this.date.native;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.date.native returns new Date on every access, and getTemplateContext runs on every pass of the days view. So each cell's template gets a new date object, even if the date hasnt changed. If there is something in the user template that compares by reference will re-run on every pass.
You could consider changing it only when the date actually changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📆 calendar ❌ status: awaiting-test PRs awaiting manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Calendar] Support custom day cell templates

4 participants