Overview
A date tile is a <time> element with the nds-date-tile class and the date in datetime. The script writes three <span> parts into an empty tile: the weekday, the day number and the month, in the page’s language and calendar. To write the parts and their text yourself, put them in the tile: the script then leaves it as written. All of them are inline elements, so the tile can sit inside a link or a button. The tile always sits beside the text of something else: a drawer row, a card header, or a timeline event. Each of them lays out the tile and its text, so the tile needs no wrapper of its own.
Pick another component when:
- the user picks a date: Date Picker
- the page counts down to a date: Countdown
- the date is one value among other details of a record: Definition List
Markup
Variants
The Drawer row, Card header and Timeline structures show the tile beside the text of each host. In a drawer row and a card header, the tile takes the place of a featured icon. Size and Status go on the .nds-date-tile element. In a drawer row, data-status can go on the li instead. It then colors the tile and any featured icon in that row. Loading goes on the host, not the tile: a drawer, a card or a timeline turns its tiles into skeleton blocks.
| Group | Option | Markup | On element | Use |
|---|---|---|---|---|
| Structure | Tile (default) | — | — | One date on its own |
| Structure | Drawer row | canon #date-tile-drawer |
— | A list of dated items, such as exams, deadlines or events. Each row is one link that holds the tile and the title |
| Structure | Card header | canon #date-tile-card |
— | One dated item in a Card, such as an exam or an event. The tile and nds-card-text share the header, and the header centers the text on the tile |
| Structure | Timeline | canon #date-tile-timeline |
— | Dated events in order, such as an exam schedule. nds-row nds-middle on each step’s content puts the tile beside the text. The tile follows the step state. See Timeline |
| Structure | Range | canon #date-tile-range |
— | A span of days, such as an exam period. data-date-end holds the last day. The tile is wider and has no weekday. Across two months it names both, such as Dec–Jan |
| Structure | Manual | canon #date-tile-manual |
— | The parts and their text written by hand. The script leaves the tile as written, so the text does not follow the page’s language or calendar. Use it for text of your own, such as a short Hijri month name: the script writes the full one. Keep datetime: it still holds the date |
| Size | SM | .nds-sm |
.nds-date-tile |
Smaller text, 48px wide, for a dense list |
| Size | MD (default) | — | — | 56px wide, for a list row |
| Size | LG | .nds-lg |
.nds-date-tile |
Larger text, 72px wide, for a card header |
| Status | None (default) | — | — | The primary color |
| Status | Success | [data-status="success"] |
.nds-date-tile |
A date that is done or confirmed |
| Status | Info | [data-status="info"] |
.nds-date-tile |
A date that changed, such as a new exam date |
| Status | Warning | [data-status="warning"] |
.nds-date-tile |
A date that is close, such as a deadline this week |
| Status | Error | [data-status="error"] |
.nds-date-tile |
A date that was missed or cancelled |
| Status | Neutral | [data-status="neutral"] |
.nds-date-tile |
A date in the past |
| Style | Dark (hint: A solid fill and white text) | .nds-dark |
.nds-date-tile |
A solid fill and white text. Use it on a primary-light surface, such as a nds-brand section, where the default fill does not show. A status gives its own solid fill |
| Weekday | No weekday | .nds-no-weekday |
.nds-date-tile:not([data-date-end]) |
Only the day number and the month, for a list where the weekday adds nothing, such as dates months apart. On a tile you write yourself, leaving out the weekday part does the same |
| Loading | Loading (hint: Skeleton placeholders while the data loads) | .nds-loading |
.nds-drawer |
The tiles and the text of the rows show as skeleton blocks while the data loads. Remove the class when the data is in |
| Loading | Loading (hint: Skeleton placeholders while the data loads) | .nds-loading |
.nds-card |
The tile and the other parts of the card show as skeleton blocks while the data loads. Remove the class when the data is in |
| Loading | Loading (hint: Skeleton placeholders while the data loads) | .nds-loading |
.nds-stepper |
Every step shows as a skeleton while its data loads, and the tile goes with it. Remove the class when the data is in |
Built-in Features
-
Inline Markup
The tile is a
<time>of<span>parts, so it is valid inside a link or a button. -
Machine-Readable Date
The
datetimeattribute holds the full date, so scripts and search engines read the date that the short text shows. -
Text from the Date
An empty tile gets its text from
datetime, before the page shows: in the page's language, and in Hijri inside adata-calendar="hijri". -
Aligned Lists
Every tile of one size has the same fixed width, so the titles in a list of rows line up. A weekday or a month too long for the width ends in an ellipsis.
-
Status from a Parent
A
data-statuson the tile or on a parent, such as a drawer row, colors the tile, the same way it colors a featured icon. In a timeline, the step state colors it: a solid fill for the current event, gray for the events to come.
Best Practices
- Use the tile for a date the user plans around, such as an exam or a deadline. Write a date in plain text when it only records when something happened.
- Write the full date in
datetime, in theYYYY-MM-DDform. - When you write the text yourself, use short names for the weekday and the month, such as “Sun” and “Dec”. The tile is narrow.
- Write the time and the place in the text beside the tile, not in the tile.
- On a primary-light surface, such as a
nds-brandsection, addnds-darkor adata-status, such asneutral. The default fill is the same color as that surface. A tile in a card needs neither. - Put the tile in a drawer row, a card header or a timeline step. On its own, put it and its text in an element with
nds-flex nds-middle. - In a timeline, leave
data-statusoff the tile. A status on the tile wins over the step state. - Leave the size class off a tile in a drawer row. Below 400px of row width the drawer steps it down to SM. A size class,
nds-mdincluded, keeps the size you wrote. - Put the tile and the item’s title in one link or button. A screen reader then reads the date and the title together.
- In a list, give every row a tile, or give none. A list with tiles on some rows does not line up.
- Set a wider
--date-tile-widthwhen the text does not fit, such as a long Hijri month like جمادى الآخرة. Set it on the list, so every tile in the list keeps the same width. - Write a range that crosses two Hijri months in the row’s text too. Hijri month names are long, and the tile cuts them short.
API
Classes
| Class | Element | Effect |
|---|---|---|
nds-date-tile |
<time> |
The box: a column of its parts, centered. The script writes the parts into an empty tile |
nds-date-tile-weekday |
<span> in the tile |
The weekday, in small text. Optional when you write the parts. A range has none |
nds-date-tile-day |
<span> in the tile |
The day number, in large bold text |
nds-date-tile-month |
<span> in the tile |
The month, in small text |
nds-md |
.nds-date-tile |
The same as no size class: 56px wide. In a drawer row it keeps that size below 400px |
nds-no-weekday |
.nds-date-tile |
Hides the weekday part |
nds-dark |
.nds-date-tile |
A solid fill and white text. A status gives its own solid fill |
Data Attributes
| Attribute | Element | Effect |
|---|---|---|
datetime |
.nds-date-tile |
The full date, such as 2026-12-13. For a range, the first day. The script writes an empty tile’s parts from it. Write it in Gregorian, on a Hijri page too |
data-date-end |
.nds-date-tile |
The last day of a range, such as 2026-12-17. The day part shows both days, and the month part both months when they differ. The tile is wider: 80px, 64px with nds-sm, 96px with nds-lg. A day that is not after datetime shows one day, with a warning in the console |
data-calendar |
.nds-date-tile or any parent |
hijri writes an empty tile in Hijri. The nearest one wins. See Date |
data-status |
.nds-date-tile or any parent |
success, info, warning, error or neutral gives the matching color. critical gives the error color |
CSS Custom Properties
Set these on the tile, or on a parent to reach every tile inside it. A data-status closer to the tile than the property wins over the colors.
| Property | Default | Controls |
|---|---|---|
--date-tile-width |
56px, 48px with nds-sm, 72px with nds-lg. A range: 80px, 64px, 96px |
The tile’s width. It wins over the size’s width |
--date-tile-bg |
var(--background-primary-light) |
Fill |
--date-tile-color |
var(--text-primary-strong) |
Text color. nds-dark keeps white text |
--date-tile-dark-bg |
var(--background-primary) |
Fill with nds-dark |
Tokens
It reads these shared tokens. A change to one also changes other components: see Tokens.
Source: the var() reads in _sass/components/_date-tile.scss.
| Token | Preview | Value |
|---|---|---|
--background-primary-lightRead by --date-tile-bg | var(--colors-primary-50)Dark mode var(--colors-primary-alpha-10) | |
--background-neutral-lightRead by --date-tile-bg | var(--colors-neutral-100)Dark mode var(--colors-alpha-white-10) | |
--background-primaryRead by --date-tile-dark-bg | var(--colors-primary-600) | |
--background-successRead by --date-tile-dark-bg | var(--colors-green-600) | |
--background-success-lightRead by --date-tile-bg | var(--colors-green-50)Dark mode var(--colors-green-alpha-10) | |
--background-infoRead by --date-tile-dark-bg | var(--colors-blue-600) | |
--background-info-lightRead by --date-tile-bg | var(--colors-blue-50)Dark mode var(--colors-blue-alpha-10) | |
--background-warningRead by --date-tile-dark-bg | var(--colors-yellow-600) | |
--background-warning-lightRead by --date-tile-bg | var(--colors-yellow-50)Dark mode var(--colors-yellow-alpha-10) | |
--background-errorRead by --date-tile-dark-bg | var(--colors-red-600) | |
--background-error-lightRead by --date-tile-bg | var(--colors-red-50)Dark mode var(--colors-red-alpha-10) | |
--text-defaultRead by --date-tile-color | var(--colors-base-black)Dark mode var(--colors-neutral-200) | |
--text-primary-strongRead by --date-tile-color | var(--colors-primary-700)Dark mode var(--colors-primary-400) | |
--text-oncolor-primary | var(--colors-base-white) | |
--text-successRead by --date-tile-color | var(--colors-green-700)Dark mode var(--colors-green-400) | |
--text-infoRead by --date-tile-color | var(--colors-blue-700)Dark mode var(--colors-blue-400) | |
--text-warningRead by --date-tile-color | var(--colors-yellow-700)Dark mode var(--colors-yellow-400) | |
--text-errorRead by --date-tile-color | var(--colors-red-700)Dark mode var(--colors-red-400) |