sandstone/DayPicker

Sandstone styled day picker components.

import DayPicker from '@enact/sandstone/DayPicker';

Members

DayPickerComponent

A day of the week selection component, ready to use in Sandstone applications.

By default, DayPicker maintains the state of its selected property. Supply the selected property to control its initial value. If you wish to directly control updates to the component, supply a value to selected at creation time and update it in response to onChange events.

Usage:

<DayPicker
  selected={[2, 3]}
  onSelect={handleSelect}
/>
import DayPicker from '@enact/sandstone/DayPicker';
Properties
aria-label
String

The "aria-label" for the component.

By default, "aria-label" is set to the full names of the selected days or the custom text when the weekend, week days, or all days is selected.

disabled
Boolean

Disables all days in this picker.

disabled
Boolean

Disables DayPicker and the control becomes non-interactive.

Default: false
onSelect
Function

Called when an day is selected or unselected.

The event payload will be an object with the following members:

  • selected - An array of numbers representing the selected days, 0 indexed where Sunday is represented by 0

selected
NumberArrayNumber

An array of numbers (0 indexed where Sunday is 0) representing the selected days of the week.

selected
NumberArrayNumber

The initial value used when selected is not set.

DayPickerBaseComponent

A day of the week selection component.

This component is most often not used directly but may be composed within another component as it is within DayPicker.

import {DayPickerBase} from '@enact/sandstone/DayPicker';

getSelectedDayStringFunction

getSelectedDayString( selected, {noneText}, {dayNameLength} )String

Determines whether it should return "Every Day", "Every Weekend", "Every Weekday" or list of days for a given selected day type.

1 or more Params
selected NumberArrayNumbernull

Selected day(s)

noneText String
optional
default: ''

String to be returned when no days are selected

dayNameLength String
optional
default: 'long'

The format for names of days

Returns
String

"Every Day", "Every Weekend", "Every Week", list of days or noneText

ArrayBooleanFunctionModuleNumberObjectString