• Start
  • Blogg
  • Kom igång
  • Riktlinjer
  • Komponenter
  • Changelog
  • Tillgänglighet
  • Statistik
  • Inställningar

Komponenter

Komponenter

​
​

Inga resultat hittade, prova med andra sökvillkor.

Date Field

Date Field

5.1.3

The Date Field component lets users select a date with the keyboard.

Demo
Props
Installation
Länkar
Tillgänglighet
Change log
Statistik

Demo

Props

Se fullständing dokumentation(öppnas i ny flik)
NamnTypBeskrivning

calendarButtonAriaLabel

stringAria label for calendar button.

customAttribute

{ attribute: string; value: string | number }Used for tests. Clickable and requested subcomponents will be suffixed with "-[ComponentName]".

customCalendarButtonRef

RefUse this if you want to bypasss internal focus handling

customTranslation

DeepPartialTranslation object used for screen reader texts.

displayFormat

stringCustom format for displaying the date in the input field. If not specified, uses the default format (e.g., "Thursday, 1 January"). Uses date-fns format tokens directly (e.g., "yyyy-MM-dd" for ISO format, "dd/MM/yyyy", "MM-dd-yyyy"). See date-fns documentation for available format tokens.

isCalendarOpen

booleanDetermines if the calendar is open.

isLoading

booleanIf true, a loading skeleton will be rendered instead of the component.

lang *

"sv" | "en"Language used for localization and date formatting.

onAccept

(value: string) => voidCallback that is fired when input value passes validation

onChange

(event: ChangeEvent) => voidCallback when field changes.

onFocus

FocusEventHandlerCallback when field is focused.

onToggleCalendar

() => voidFunction to run on open calendar button.

required

booleanIf true, aria-required="true" will be added to the input element, informing assistive technologies that the field is mandatory. ⚠️ Note: This does not enable native HTML validation or add a visual asterisk. If a visual indication is needed, you must manually add a * to the label yourself.

showCalendarButton

booleanDetermines whether to display the Calendar IconButton within the DateField.

timeZone

stringSet timezone for the DateField

value *

stringDateField value.

Installation

Kodexempel
npm install @sj-ab/component-library.ui.date-field

Länkar

  • Storybook

  • Figma

  • Bit.cloud

Tillgänglighet

Se dokumentationen av tillgängligheten för komponenterna DatePicker och TextField:

Text Field

Date Picker

Change log

  • Allow custom date format in DateField via new dateFormat prop

    5.1.0
  • Remove maxDate and minDate props from DateField

    5.0.5
  • Enhance DateField and TimePicker accessibility with aria-haspopup

    5.0.4
  • Removed functionality for internal validation in DateField

    5.0.2
  • Clean up component-library folder and update documentation in Storybook

    5.0.1

Statistik