Skip to main content
For development, import DaysOfTheWeek from @servicetitan/anvil2. For design, find it in the Anvil2 file.

Anatomy

The Days of the Week consists of ten primary elements that work together to allow users to select days of the week.
Anatomy image for the Days of the Week
component
  1. Label
  2. First day of the week (in disabled state)
  3. Second day of the week (in checked state)
  4. Third day of the week (in checked state)
  5. Fourth day of the week (in hovered state, with tooltip with full name)
  6. Fifth day of the week (in unchecked state)
  7. Sixth day of the week (in unchecked state)
  8. Seventh day of the week (in disabled state)
  9. Hint/error text (in errored state)
  10. Description text

Options

The Days of the Week supports configurable start date configurations to accommodate various week representation scenarios.

Default start date

By default, Days of the Week starts the week on Sunday.

Configured start date

This behavior is configurable. The first day of the week here is set to Monday.

Behavior

The Days of the Week responds to user interaction with distinct visual states and responsive width behaviors.

Visual States

Day States

Each day of the week can be unchecked, checked, or disabled. On hover, the day of the week displays the full name of the day.

Responsive Behavior

Days of the Week shrinks to 328px wide and grows to a maximum of 748px wide.

Usage Guidelines

How to Use

Accessible Labels

Single day of the week with an accessible label in
tooltip
Do
Display the full day name on hover
A hovered single day without an accessible
label
Don’t
Omit an accessible label for the day on hover

Abbreviation

Do
Use 2-letter abbreviations for day names (e.g., Mo, Tu, We)
Don’t
Use three letter name abbreviations, or full day names with uneven widths.

Content

Content within the Days of the Week should clearly communicate day selections through consistent abbreviations.

How to abbreviate days of the week

  • To keep interfaces clear and scannable, use two-letter abbreviations for days of the week (e.g., Mo, Tu, We). These are concise, easy to read at a glance, and align with how similar tools present this information.
  • When possible, pair the abbreviation with a tooltip that shows the full day name on hover. This improves accessibility and helps avoid confusion, especially for less common abbreviations like “Tu” or “Th.”

Which day starts the week

  • By default, weeks start on Sunday in the date recurrence picker. This setting is configurable from within the component.

Keyboard Interaction

Users can navigate the Days of the Week using standard keyboard controls.

Accessibility

Anvil provides most of the accessibility needs for Days of the Week out of the box, and only needs some additional considerations for library users. For more guidance on form field labels and context, see input field context association best practices.

Code

Common Examples

Labeling

DaysOfTheWeek can be given optional labeling props to help users understand the context around the component.
For more information on how to use these these props, check out our forms pattern documentation.

Disabled

Fully disabled

The DaysOfTheWeek can be marked disabled to disable all of the days.

Partially disabled

The DaysOfTheWeek can be marked disabled={number[]} to disable specific days of the week.

Alternative Starting Day

Depending on your needs, the DaysOfTheWeek component can accept an alternative starting day via the firstDay prop. Here’s an example showing Monday as the first day of the week:

Static day numbers

When using the firstDay prop, it’s important to recognize that the numbers used to index days remain static. This prop only adjusts how the buttons are layout out visually.This means that props like selectedDays and disabled continue to treat Monday as 1, Tuesday as 2, and so on.

Best Practices

Day Numbers

Take notice of the numbers used for selectedDays, onChange, firstDay, and disabled. If you are familiar with the Date object’s getDay method, you may find them surprising at first.We use numbers 1-7 to number days, beginning with Monday as 1 proceeding through Sunday as 7. This is an intentional decision based on a goal to remain consistent the Intl.Locale.prototype.getWeekInfo() and Temporal.PlainDate.prototype.dayOfWeek APIs.This is a implementation choice rooted in consideration of the ever evolving and improving web standards. We acknowledge that Date.prototype.getDay() uses 0-6 for Sunday-Saturday but we do not plan on matching this API. We prefer the more powerful and complete Intl and Temporal APIs.
Last modified on October 27, 2026