Skip to main content
Login

Sign in to access your account

Date Tile - National Design System

A date tile shows one date in a small box, with the weekday, the day number and the month

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:

Markup

Options
Structure
Size
Status
More
Preview
<time class="nds-date-tile" datetime="2026-12-13"></time>

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 datetime attribute 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 a data-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-status on 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 the YYYY-MM-DD form.
  • 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-brand section, add nds-dark or a data-status, such as neutral. 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-status off 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-md included, 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-width when 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.

TokenPreviewValue
--background-primary-light
Read by --date-tile-bg

var(--colors-primary-50)
Dark mode var(--colors-primary-alpha-10)
--background-neutral-light
Read by --date-tile-bg

var(--colors-neutral-100)
Dark mode var(--colors-alpha-white-10)
--background-primary
Read by --date-tile-dark-bg
var(--colors-primary-600)
--background-success
Read by --date-tile-dark-bg
var(--colors-green-600)
--background-success-light
Read by --date-tile-bg

var(--colors-green-50)
Dark mode var(--colors-green-alpha-10)
--background-info
Read by --date-tile-dark-bg
var(--colors-blue-600)
--background-info-light
Read by --date-tile-bg

var(--colors-blue-50)
Dark mode var(--colors-blue-alpha-10)
--background-warning
Read by --date-tile-dark-bg
var(--colors-yellow-600)
--background-warning-light
Read by --date-tile-bg

var(--colors-yellow-50)
Dark mode var(--colors-yellow-alpha-10)
--background-error
Read by --date-tile-dark-bg
var(--colors-red-600)
--background-error-light
Read by --date-tile-bg

var(--colors-red-50)
Dark mode var(--colors-red-alpha-10)
--text-default
Read by --date-tile-color

var(--colors-base-black)
Dark mode var(--colors-neutral-200)
--text-primary-strong
Read by --date-tile-color

var(--colors-primary-700)
Dark mode var(--colors-primary-400)
--text-oncolor-primaryvar(--colors-base-white)
--text-success
Read by --date-tile-color

var(--colors-green-700)
Dark mode var(--colors-green-400)
--text-info
Read by --date-tile-color

var(--colors-blue-700)
Dark mode var(--colors-blue-400)
--text-warning
Read by --date-tile-color

var(--colors-yellow-700)
Dark mode var(--colors-yellow-400)
--text-error
Read by --date-tile-color

var(--colors-red-700)
Dark mode var(--colors-red-400)
Last Modified Date: 05/11/2026 - 12:02 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks