Skip to content

TimeSelect Time Selection

Rules

Basic Example

js
const rule = {
    type: "elTimeSelect",
    field: "time",
    title: "Activity Time",
    value: [],
    props: {
        start:"08:30",
        step:"00:15",
        end:"18:30",
    },
}

Props Configuration Examples

Work Time Selection

js
const rule = {
    type: "elTimeSelect",
    field: "workTime",
    title: "Work Time",
    value: "09:00",
    props: {
        start: "09:00",
        end: "18:00",
        step: "00:30",
        placeholder: "Select time",
    },
}

Include End Time

js
const rule = {
    type: "elTimeSelect",
    field: "endTime",
    title: "End Time",
    value: "18:00",
    props: {
        start: "09:00",
        end: "18:00",
        step: "01:00",
        includeEndTime: true,
        placeholder: "Select end time",
    },
}

Limit Time Range

js
const rule = {
    type: "elTimeSelect",
    field: "appointment",
    title: "Appointment Time",
    value: "10:00",
    props: {
        start: "08:00",
        end: "20:00",
        step: "00:15",
        minTime: "09:00",
        maxTime: "18:00",
        placeholder: "Select appointment time",
    },
}

Events Examples

Listen to Time Changes

js
const rule = {
    type: "elTimeSelect",
    field: "time",
    title: "Activity Time",
    value: "09:00",
    props: {
        start: "08:00",
        end: "18:00",
        step: "00:30",
        placeholder: "Select time",
    },
    on: {
        change: (value) => {
            console.log('Time changed:', value);
        },
        blur: (event) => {
            console.log('Lost focus:', event);
        },
        focus: (event) => {
            console.log('Gained focus:', event);
        },
        clear: () => {
            console.log('Cleared time');
        },
    },
}

Full configuration: Element_TimeSelect

value :String

Props

Attribute NameDescriptionTypeDefault Value
disabledDisabled statebooleanfalse
editableWhether the text box can be editedbooleantrue
clearableWhether to show clear buttonbooleantrue
includeEndTimeWhether to include end in optionsbooleanfalse
sizeInput box sizeenumdefault
placeholderPlaceholder content for non-range selectionstring
nameNative attributestring
effectTooltip theme. Built-in dark / light themesstring / enumlight
prefixIconCustom prefix iconstring / ComponentClock
clearIconCustom clear iconstring / ComponentCircleClose
startStart timestring09:00
endEnd timestring18:00
stepInterval timestring00:30
minTimeEarliest time point. Time periods earlier than this time will be disabledstring
maxTimeLatest time point. Time periods later than this time will be disabledstring
formatSet time formatstring see formatsHH:mm
emptyValuesEmpty value configuration for component Refer to config-providerarray
valueOnClearValue when clearing options Refer to config-providerstring / number / boolean / Function

Events

Event NameDescriptionType
changeTriggered when user confirms selected valueFunction
blurTriggered when component Input loses focusFunction
focusTriggered when component Input gains focusFunction
clearTriggered when user clicks clear button in clearable single selection modeFunction

FormCreate is an open-source project released under the MIT License. Free for personal and commercial use.