Skip to main content

We have released KoliBri - Public UI v4 (Next). For the LTS version, see .

Your opinion matters! Together with you, we want to continuously improve KoliBri. Share your ideas, wishes, or suggestions—quickly and easily.

InputDate

Synonyms: Date Picker, Datetime Picker, Week Picker Month Picker, Time Picker, Calendar

The input type Date creates an input field for date values. These can be specific dates, but also weeks, months or times.

Construction

Code

<kol-input-date _type="date" _label="Erstellungsdatum" _icons='{"right": "codicon codicon-calendar"}'></kol-input-date>

Events

For the handling of events or callbacks, see .

EventtriggerValue
clickInput field is clicked-
focusInput field is focused-
blurInput field loses focus-
inputValue is changed by enteringCurrent value of the input field
changeEntry has been completedCurrent value of the input field

Example

Remove date

The following example shows a component in React that offers the option of removing the value in the date field using a button.

const ClearableDateInput = () => {
const [value, setValue] = useState<Date>();
return (
<>
<KolInputDate
_label="Lorem ipsum dolor sit"
_value={value}
_on={{ onChange: (_, v: Date) => setValue(v) }}
/>
{/* Set null as value to clear the inputs value. */}
<KolButton _on={{ onClick: () => setValue(null) }} _label="Clear" />
</>
);
};

Events

Component events can be handled via a _on property, which consists of an object with various callback functions:

kolibriElement._on = {
onFocus: (event) => {
/* Do something on focus */
},
onInput: (event, value) => {
/* Do something with value or event */
},
// ...
};
EventtriggerValue
onFocusElement is focused-
onClickElement is clicked-
onInputDate is set or changes (corresponds to native input event)Date entered as ISO8601 String
onChangeDate is set or changes (corresponds to native change event)Date entered as ISO8601 String
onBlurElement loses focus-

Usage

The InputDate component can be used to capture data. It internally uses the InputNumber component.

Beachten Sie, dass im Firefox nicht alle _types der InputDate-Komponente funktional sind. Es werden bei den Typen month, time und week keine Auswahldialoge angezeigt.

The component stands out because it supports numerous number-based input patterns. It is important to note that input behavior can vary from browser to browser and device to device. For example, it is possible to enter 01/01/999999 for the date, even if max=2022-02-02. The field value is still 2022-02-02.

Best practices

  • Make sure to set id and name correctly so that the data is sent when you submit the form.

Accessibility

The icons in the component cannot be accessed using the Tab key. The component selection aids are opened using the space bar or Enter. For example, with the type date you get a calendar module that can be used to select the desired date using the mouse or keyboard. Alternatively, you can enter the values ​​manually.

Known issues

There are known accessibility limitations for the input date.

Keyboard controls

The input field for time information comes in different versions (date, time, etc.). The 'Tab' key sets the focus on the input field. The device-specific selection dialog can then be opened using the 'Space' key.

Note: We found in our tests that, depending on the browser version, it is sometimes possible to focus on the calendar icon and sometimes not. Without the implementation of the component having changed. We don't yet know why this is the case. Nevertheless, opening the selection dialog is always possible using the 'Space' key.

buttonFunction
TabFocuses the input field. After receiving focus, the 'Tab' key switches through the input areas. Only then does the 'Tab' key switch to the next input field.
EmptyIf the input field is focused, a selection dialog can be opened or closed in the browser using the 'space' key. Navigation and selection is done here using the 'Tab' key, the 'arrow' keys and confirmation with the 'Enter' key.
Arrow keys (left/right)When the input field is focused, you can use the 'arrow' keys to switch between the input areas.
Arrow keys (up/down)If an input area is activated, the values ​​can be changed using the arrow keys up and down.
EscIf a selection dialog is available, it can be closed alternatively using the 'Space' key or the 'Esc' key.

Properties

PropertyAttributeDescriptionTypeDefault
_accessKey_access-keyDefines the key combination that can be used to trigger or focus the component's interactive element.string | undefinedundefined
_autoComplete_auto-completeDefines whether the input can be auto-completed.string | undefined'off'
_disabled_disabledMakes the element not focusable and ignore all events.boolean | undefinedfalse
_hideLabel_hide-labelHides the caption by default and displays the caption text with a tooltip when the interactive element is focused or the mouse is over it.boolean | undefinedfalse
_hideMsg_hide-msgHides the error message but leaves it in the DOM for the input's aria-describedby.boolean | undefinedfalse
_hint_hintDefines the hint text.string | undefined''
_icons_iconsDefines the icon classnames (e.g. _icons="fa-solid fa-user").string | undefined | { right?: IconOrIconClass | undefined; left?: IconOrIconClass | undefined; }undefined
_id_id[DEPRECATED] Will be removed in the next major version.

Defines the internal ID of the primary component element.
string | undefinedundefined
_label (required)_labelDefines the visible or semantic label of the component (e.g. aria-label, label, headline, caption, summary, etc.). Set to false to enable the expert slot.stringundefined
_max_maxDefines the maximum value of the element.Date | `${number}-${number}-${number}T${number}:${number}:${number}` | `${number}-${number}-${number}T${number}:${number}` | `${number}-${number}-${number}` | `${number}-${number}` | `${number}-W${number}` | `${number}:${number}:${number}` | `${number}:${number}` | undefinedundefined
_min_minDefines the smallest possible input value.Date | `${number}-${number}-${number}T${number}:${number}:${number}` | `${number}-${number}-${number}T${number}:${number}` | `${number}-${number}-${number}` | `${number}-${number}` | `${number}-W${number}` | `${number}:${number}:${number}` | `${number}:${number}` | undefinedundefined
_msg_msgDefines the properties for a message rendered as Alert component.Omit<AlertProps, "_on" | "_hasCloser" | "_label" | "_level" | "_variant"> & { _description: string; } | string | undefinedundefined
_name_nameDefines the technical name of an input field.string | undefinedundefined
_on--Gibt die EventCallback-Funktionen für das Input-Event an.InputTypeOnBlur & InputTypeOnClick & InputTypeOnChange & InputTypeOnFocus & InputTypeOnInput & InputTypeOnKeyDown | undefinedundefined
_readOnly_read-onlyMakes the input element read only.boolean | undefinedfalse
_required_requiredMakes the input element required.boolean | undefinedfalse
_shortKey_short-keyAdds a visual shortcut hint after the label and instructs the screen reader to read the shortcut aloud.string | undefinedundefined
_smartButton_smart-buttonAllows to add a button with an arbitrary action within the element (_hide-label only).string | undefined | { _label: string; } & { _ariaExpanded?: boolean | undefined; _tabIndex?: number | undefined; _value?: StencilUnknown; _accessKey?: string | undefined; _role?: "tab" | "treeitem" | undefined; _ariaControls?: string | undefined; _ariaDescription?: string | undefined; _ariaSelected?: boolean | undefined; _on?: ButtonCallbacksPropType<StencilUnknown> | undefined; _type?: "button" | "reset" | "submit" | undefined; _variant?: "primary" | "secondary" | "normal" | "tertiary" | "danger" | "ghost" | "custom" | undefined; _customClass?: string | undefined; _disabled?: boolean | undefined; _hideLabel?: boolean | undefined; _icons?: IconsPropType | undefined; _id?: string | undefined; _inline?: boolean | undefined; _name?: string | undefined; _shortKey?: string | undefined; _syncValueBySelector?: string | undefined; _tooltipAlign?: AlignPropType | undefined; }undefined
_step_stepDefines the step size for value changes.`${number}.${number}` | `${number}` | number | undefinedundefined
_suggestions_suggestionsSuggestions to provide for the input.W3CInputValue[] | string | undefinedundefined
_tooltipAlign_tooltip-alignDefines where to show the Tooltip preferably: top, right, bottom or left."bottom" | "left" | "right" | "top" | undefined'top'
_touched_touchedShows if the input was touched by a user.boolean | undefinedfalse
_type_typeDefines either the type of the component or of the components interactive element."date" | "datetime-local" | "month" | "time" | "week"'date'
_value_valueDefines the value of the element.Date | `${number}-${number}-${number}T${number}:${number}:${number}` | `${number}-${number}-${number}T${number}:${number}` | `${number}-${number}-${number}` | `${number}-${number}` | `${number}-W${number}` | `${number}:${number}:${number}` | `${number}:${number}` | null | undefinedundefined

Methods

getValue

getValue() => Promise<string | Date | undefined | null>

Returns the current value.

Returns

Type: Promise<string | Date | null | undefined>

kolFocus() => Promise<void>

Sets focus on the internal element.

Returns

Type: Promise<void>

reset() => Promise<void>

Resets the component's value.

Returns

Type: Promise<void>

Slots

SlotDescription
Die Beschriftung des Eingabefeldes.

Usage _msg

Case_msg-Value
No messageundefined
Default error messagestring
Message{_type: 'success', _description: 'Success message'}

View example

Live editor

Examples