Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Revert `word-break: break-word` addition ([#76230](https://github.com/WordPress/gutenberg/pull/76230)).

### Enhancements

- `DateCalendar`, `DateRangeCalendar`: Add `showOutsideDays` and `fixedWeeks` props and style outside-month days ([#76199](https://github.com/WordPress/gutenberg/pull/76199)).

## 32.3.0 (2026-03-04)

### Code Quality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ export const WithSelectedDateAndMonth: Story = {
},
};

/**
* Shows days from adjacent months in the grid. Outside days use a lighter style
* and are still interactive. Use `fixedWeeks` to keep the grid height constant.
*/
export const WithOutsideDays: Story = {
args: {
showOutsideDays: true,
fixedWeeks: true,
},
};

/**
* When working with time zones, use the `TZDate` object exported by this package instead of the native `Date` object.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ export const WithSelectedRangeAndMonth: Story = {
},
};

/**
* Shows days from adjacent months in the grid. Outside days use a lighter style
* and are still interactive. Use `fixedWeeks` to keep the grid height constant.
*/
export const WithOutsideDays: Story = {
args: {
showOutsideDays: true,
fixedWeeks: true,
},
};

/**
* When working with time zones, use the `TZDate` object exported by this package instead of the native `Date` object.
*/
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/calendar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
}
}

// Outside month days (visible when showOutsideDays is true): use a lighter text color.
.components-calendar__day--outside {
color: $components-color-gray-600;

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.

We may potentially want to use the same shade of gray that we use for disabled days (ie. $components-color-gray-400), althouth this is something to confirm with @WordPress/gutenberg-design folks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went with $components-color-gray-600 since it looked closer to the shade used in the proposal #76150. I also thought it might be better to keep it different from the disabled days, since outside days are still clickable and could themselves be disabled. In that case, using a different base shade might help distinguish the two states.

Happy to adjust if we get a confirmation from the @WordPress/gutenberg-design folks.

@ciampo ciampo Mar 6, 2026 •

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.

Sounds good. We can probably merge as-is and update the color later, if needed.

Potentially we may also consider showing the outer days with the same text color as regular non-disabled days. I'm afraid that currently the different is too subtle and could cause confusion.

Screenshot 2026-03-06 at 11 31 23

}

// Hidden button (ie. outside current month but still rendered)
.components-calendar__day--hidden {
visibility: hidden;
Expand Down
12 changes: 12 additions & 0 deletions packages/components/src/calendar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ export interface BaseProps
* @default 1
*/
numberOfMonths?: number;
/**
* When `true`, days from adjacent months are shown in the grid and receive
* the `outside` modifier and the class.
* @default false
*/
showOutsideDays?: boolean;
/**
* When `true`, the calendar always shows a fixed number of weeks (e.g. 6)
* so the grid height does not change between months.
* @default false
*/
fixedWeeks?: boolean;
/**
* The earliest month to start the month navigation.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/calendar/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const CLASSNAMES = {
root: 'components-calendar',
day: 'components-calendar__day',
day_button: 'components-calendar__day-button',
outside: 'components-calendar__day--outside',
caption_label: 'components-calendar__caption-label',
button_next: 'components-calendar__button-next',
button_previous: 'components-calendar__button-previous',
Expand Down
Loading