Rost

← All components

component

DateField

A date, picked from a Calendar. Select's field, showing the date, and a Calendar in a Popover under it when it's pressed.

In code Contract: review Guidance: proposed Contract on GitHub Figma 752:50 As markdown

Try it

Every variant

Default · Not error
Disabled · Not error
An invoice can’t be dated after today
Default · Error

Hover, press or tab to one to see the other 4 states.

Install

npx github:Runceanu/rost add date-field

It lands in src/rost/date-field/, with what it needs and its contract. Install has the rest.

When to use

  • A date on a form

    An invoice's date, the day a payment arrived. It sits with Inputs and Selects and looks like them.

When not to use

Behaviour

It looks like Select, and uses Select's colours, so a form with both reads as one. Pressing it opens a Calendar in a Popover under it, on the picked month. Picking a day closes the Popover, puts the date in the field and the focus back on it. Esc or a click outside closes it without a change. The date is written the locale's way, like Nov 17, 2026. With range it takes two dates: the first press in the Calendar is the start, the second the end, and the Popover closes then. The field shows both, with the year once when they share it.

Accessibility

  • Element

    A <button> named by its <label>, with aria-haspopup="dialog" and aria-expanded. The Popover holds the Calendar, which has its own grid.

  • Name

    label. The button says the date too, so a screen reader hears both: Invoice date, Nov 17, 2026.

  • Keyboard

    Tab reaches it, Enter or Space opens it with the focus on the picked day, and the Calendar's keys work from there. Esc closes it.

  • Focus

    focus-ring around the field, on :focus-visible.

  • Error

    error sets aria-invalid and ties the help line to the button. The words say what's wrong.

  • Colour

    Select's: the edge is 4.3:1 on the dark page.

Content

A label that names the date: Invoice date, not Date.

Props

PropTypeValuesDefault
label slot
value node
range node
placeholder string Pick a date
min node
max node
locale string en
supportive slot
error boolean false

States: Default, Hover, Focus, Disabled.

Values

Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.

Never changes

root

  • height 56px spacing/size/large
  • width 208px no token yet

displayblock · positionrelative

outline

  • border-style solid no token yet
  • border-width 1px spacing/outline/small
  • border-radius 12px spacing/radius/medium

positionabsolute · inset0 · pointer-eventsnone

label

  • top 12px spacing/gap/small-medium
  • left 12px spacing/gap/small-medium
  • font-family 'General Sans Variable' font-family/base
  • font-weight 400 typography/label/font-weight/regular
  • font-size 10px typography/placeholder/font-size
  • line-height 12px typography/placeholder/line-height
  • letter-spacing 0px typography/placeholder/letter-spacing

positionabsolute · pointer-eventsnone

field

  • padding-top 24px spacing/gap/large
  • padding-bottom 12px spacing/gap/small-medium
  • padding-left 12px spacing/gap/small-medium
  • padding-right 40px spacing/size/medium
  • font-family 'General Sans Variable' font-family/base
  • font-weight 400 typography/paragraph/font-weight/regular
  • font-size 14px typography/paragraph/font-size
  • line-height 20px typography/paragraph/line-height
  • letter-spacing 0px typography/paragraph/letter-spacing

displayblock · width100% · text-alignleft · white-spacenowrap · positionabsolute · inset0 · appearancenone · backgroundtransparent · bordernone · outlinenone · cursorpointer

chevron

  • top 20px spacing/gap/medium-large
  • right 12px spacing/gap/small-medium
  • width 20px spacing/size/xsmall
  • height 20px spacing/size/xsmall
  • mask url(./icon-chevron.svg) center / contain no-repeat on purpose: The icon file itself.

positionabsolute · pointer-eventsnone

supportive

  • left 12px spacing/gap/small-medium
  • top calc(var(--spacing-size-large) + var(--spacing-gap-2xsmall)) on purpose: Composed from tokens: the field's height plus spacing/gap/2xsmall.
  • font-family 'General Sans Variable' font-family/base
  • font-weight 500 typography/label/font-weight/medium
  • font-size 10px typography/placeholder/font-size
  • line-height 12px typography/placeholder/line-height
  • letter-spacing 0px typography/placeholder/letter-spacing

positionabsolute · white-spacenowrap

focus-ring

  • border-style solid no token yet
  • border-width 2px spacing/outline/medium
  • border-radius 16px spacing/radius/large

displaynone · positionabsolute · insetcalc(-1 * var(--spacing-gap-2xsmall)) · pointer-eventsnone

Changes by variant

7 variants. Each table is what one thing changes with: a column per error, a row per property. Where every row starts with the same token path, it's written once, under the property.

Follows error

Focus

PropertyNot errorError
focus-ring.border-colorselect/… focus/focus-ring #00d669 negative/focus/focus-ring #00d669

Follows state and error

Not error

PropertyDefaultHoverFocusDisabled
chevron.backgroundselect/… default/chevron #00d669 hover/chevron #00b450 focus/chevron #00d669 disabled/chevron #b6ffda
field.colorselect/… default/value #c2c7c3 hover/value #d3d9d5 focus/value #c2c7c3 disabled/value #555555
label.colorselect/… default/label #999999 hover/label #d3d9d5 focus/label #999999 disabled/label #555555
outline.backgroundselect/… default/background #060805 hover/background #171717 focus/background #060805 disabled/background #171717
outline.border-colorselect/… default/outline #747573 hover/outline #999999 focus/outline #747573 disabled/outline #3a3a3a
supportive.colorselect/… default/supportive #999999 hover/supportive #d3d9d5 focus/supportive #999999 disabled/supportive #555555

Error

PropertyDefaultHoverFocusDisabled
chevron.backgroundselect/negative/… default/chevron #e93120 hover/chevron #e93120 focus/chevron #e93120·
field.colorselect/negative/… default/value #999999 hover/value #999999 focus/value #c2c7c3·
label.colorselect/negative/… default/label #e93120 hover/label #f2705f focus/label #e93120·
outline.backgroundselect/negative/… default/background #060805 hover/background #171717 focus/background #060805·
outline.border-colorselect/negative/… default/outline #f2705f hover/outline #e93120 focus/outline #f2705f·
supportive.colorselect/negative/… default/supportive #e93120 hover/supportive #e93120 focus/supportive #e93120·

Only in some variants

These don't change: they're just set in some variants and not others.

Disabled

  • chevron.opacity 0.16 opacity/soft

Focus

  • focus-ring.display block layout