TimePicker / TimeRangePicker
Time and intervals with formats, steps and confirmation.
When to use
TimePicker selects time through an input field and columns of hours, minutes and seconds. TimeRangePicker specifies the beginning and end of the interval in the general panel. For a calendar date along with time, use DatePicker with showTime.
The standard TimePicker and TimeRangePicker use Dayjs. Your application chooses the date and time zone to store alongside the selected time.
Meaning and confirmation
The value of a single field is Dayjs | null. For control, pass value and assign the result of onChange to the Svelte state. defaultValue specifies only the initial local time. Guided Example changes the model by input and external button.
| Problem | Setting | Example |
|---|---|---|
| Set start time | defaultValue |
Base time |
| Control the model from the outside | value, onChange |
Managed time |
| Compare confirmation and application without OK | needConfirm |
Time confirmation |
| Change the time by scrolling the column | changeOnScroll |
Change by scroll |
| Enter hours, minutes and milliseconds | A format object with type: 'mask' |
Time input mask |
Save Dayjs to Form |
form.setFieldValue |
Time in Form |
By default needConfirm=true: selecting a column changes the draft, OK publishes the value. onCalendarChange reports the intermediate time, onChange reports the accepted result. For a single field, the third argument to onCalendarChange is an empty object; the range context refers to a range. When clearing a single field completely, both value and the string argument to onChange are null.
needConfirm=false allows use without a separate button. Don't use text change as a replacement for onChange: previewValue=hover temporarily shows the time under the pointer without calling onChange or onCalendarChange. false disables preview.
defaultOpenValue sets the initial panel candidate and OK, leaving the field itself empty until selected. changeOnScroll selects the closest allowed bit after manual scrolling; the confirmation rule is preserved. Scrolling example combines it with needConfirm=false.
OK sends the draft to onOk before calling onChange and requesting closure. The order stays the same when the app accepts the new value or closes the panel in onOk. For a range, onChange publishes the changed pair after the available endpoints are confirmed.
In multiple mode, TimePicker takes an array of Dayjs dates in value. Its onChange supplies arrays of times and strings. Clearing the field returns null in both arguments. The multiple time example shows a controlled array with an OK button to confirm the selection.
Format, columns and restrictions
format specifies the output and column composition: HH:mm leaves hours and minutes. Explicit showHour/showMinute/showSecond/showMillisecond override the visibility of the corresponding bits. Example formats show the composition of the panel separately from the model value.
In the masked time example, use the left and right arrows to move between hours, minutes, seconds and milliseconds. Type the digits and press Enter. The panel offers 100 ms increments, but you can type a value such as 347 ms. The range uses an HH:mm mask for both endpoints.
use12Hours enables selection of day period; in 12 hour example the field shows h:mm a, and the result is the same data in HH:mm. The format string does not turn the Dayjs object into a string model.
Use hourStep, minuteStep, secondStep and millisecondStep to set the increment for each column. Use disabledTime to restrict the available hours, minutes, seconds and milliseconds. In the working hours example, hideDisabledOptions hides unavailable choices.
The disabledSeconds callback receives the hour and minute. The disabledMilliseconds callback also receives the second. If the field is empty and all minutes are unavailable, disabledSeconds gets the minute from the panel time. For example, with pickerValue set to 08:09, the callback receives 9 for the minute. With hideDisabledOptions enabled, the minute column stays empty.
To restrict selection to the panel, use a plain format string with inputReadOnly. Masked fields still accept keyboard edits. The disabled property disables the entire field. status shows the status of the check, and mandatory rules and application restrictions are specified in Form. The dictionary comes from ConfigProvider or locale; for another language, match it to the Day.js locale.
Range and form submission
TimeRangePicker accepts a pair of Dayjs with possible empty borders or null. When confirmed, each boundary goes through its own selection and OK; onCalendarChange reports info.range=start/end. onChange returns the accepted pair; if completely cleared, both arguments are null. Range example outputs the result only after the boundaries are confirmed.
defaultOpenValue accepts one start date for start or a pair of candidates. allowEmpty allows empty borders, disabled blocks start and end independently, order defaults to ordering the selected times. For dependent constraints, disabledTime gets partial and info.from. Application example stores meeting time and work interval in separate models.
When you type a time into a saved range, TimeRangePicker and the generated RangePicker with picker="time" keep the date of the endpoint you edit. This also applies to masked input. For example, if you edit the start of an overnight shift, the end stays on the following day. If the format includes a date, onChange returns the day you entered.
In America/New_York, clocks jumped from 01:59 to 03:00 on March 8, 2026. If you open a range from March 7 on that day, you can still enter 02:31 using the HH:mm format. For an endpoint dated March 8, that local time does not exist, so the field keeps its previous value.
In call form onChange calls form.setFieldValue, required checks for time, reset restores initialValues. Store Dayjs before preparing the request. The application determines whether to pass the time as a string, how to associate it with the date, time zone, and desired precision.
Snippets and design
cellRender receives rank and info with subType and originNode. Render the originNode to save the native button, constraints and handlers. panelRender receives a standard panel snippet; add your content around it. Panel example keeps both original structures and adds the “Lunch” preset. renderExtraFooter receives the current panel mode and renders content at the bottom.
In the appointment example, components.time replaces the columns with preset choices. The panel reads restrictions from showTime.disabledTime. The OK button confirms the time, and a range is edited from the start to the end. The custom panel guide describes the context passed to the snippet.
The panel calls onModeChange to switch modes. Use TimePickerProps<DatePickerMode> or TimeRangePickerProps<DatePickerMode> to type the corresponding handlers.
In the time fields example, a snippet requests a numeric keyboard and the mask adds the colon between hours and minutes. TimeRangePicker passes range to each endpoint's editor. See the DatePicker editor guide for how to connect the field.
Use autoFocus to set the initial focus, tabIndex to control the tab order, and autoComplete to control browser autocomplete. These props also work with fields created by generatePicker. DatePicker focus example.
TimePicker and TimeRangePicker inherit the common ConfigProvider.prefixCls from -picker. Local non-empty prefixCls specifies the full name of the field, popup and columns; empty string/undefined select the provider. cellRender gets its resolved name via info.prefixCls, its originNode uses the same classes. The OK button inherits a separate common Button prefix. CSS time prefixes allow you to compare both fields, RTL and a separate namespace theme.cssVar.prefix.
Changing the prefix of a controlled TimePicker or TimeRangePicker keeps the panel open and preserves focus, typed text, the selection and the time awaiting confirmation. The design supports the standard, dark and compact theme without the required cssVar. The prefix/suffix color service variable uses the common provider prefix without dots, regardless of the local name and namespace of the theme; canonical area markers are preserved.
classNames and styles support root, prefix, input, suffix and nested popup slots. styles accepts CSS strings and objects. Both settings can be functions that receive the picker's props. The Semantic DOM example shows these settings in use.
Callbacks in ConfigProvider.timePicker can receive the props of a single, multiple, or range picker. Use Array.isArray to check the shape of props.value. When using different date adapters, check the date with dayjs.isDayjs before calling Day.js methods.
TimeRangePicker uses rangePicker.variant for variant. Component design tokens are set through the shared theme.components.DatePicker map and apply to both the field and the time panel.
The field needs an accessible name. The focus/blur methods are accessible via the instance; focus takes cursor=start/end/all, and the range also has index bounds. Escape closes the popup; Native panel buttons retain keyboard control. See the API for the supported options.
Use popupAlign and builtinPlacements to set anchor points and offsets for TimePicker and TimeRangePicker. The panel placement example shows how they work together.
Examples
Base time
Local value defaultValue. The panel contains hours, minutes and seconds.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<TimePicker
aria-label={("Base time")}
defaultValue={dayjs('2026-10-15T13:30:56')}
/>
Controlled time
Dayjs | null is stored in $state and updated via onChange. The button changes the same model on the outside.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { Button, TimePicker } from '@woodger/antd';
let value = $state<Dayjs | null>(dayjs('2026-10-15T09:30:00'));
</script>
<style>.example {
display: grid;
gap: 16px;
} .row {
display: flex;
flex-wrap: wrap;
gap: 12px;
}</style>
<div class="example">
<div class="row">
<TimePicker
aria-label={("Controlled time")}
{value}
format="HH:mm"
onChange={next => { value = next; }}
/>
<Button onclick={() => { value = dayjs('2026-10-15T12:00'); }}>
{("Set noon")}
</Button>
</div>
<output aria-label={("Time model")}>{(value?.format('HH:mm') ?? 'null')}</output>
</div>
Multiple time selection
multiple stores selected times in a Dayjs array. popupAlign sets the popup gap, and transitionName selects the animation.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { TimePicker } from '@woodger/antd';
let value = $state<Dayjs[]>([dayjs('2026-12-01T09:00:00')]);
</script>
<TimePicker
multiple
format="HH:mm"
minuteStep={15}
{value}
needConfirm
popupAlign={{ offset: [0, 8] }}
transitionName="ant-slide-up"
onChange={next => { value = next ?? []; }}
aria-label={("Select several times")}
/>
<p><output aria-label={("Selected time")}>{
value.map(time => time.format('HH:mm')).join(', ') || ("Empty")
}</output></p>
Time and interval with JavaScript Date
Choose a meeting time in the panel. You can type the working hours in UTC.
NativeTimePickers.svelte<script lang="ts"> import { DatePicker, Flex, type RangePickerValue } from '@woodger/antd'; import { nativeDateAdapter } from './native-date-adapter'; const { TimePicker, RangePicker } = DatePicker.generatePicker(nativeDateAdapter); const initialTime = new Date('2026-10-15T13:30:00Z'); const initialRange: RangePickerValue<Date> = [ new Date('2026-10-15T09:00:00Z'), new Date('2026-10-15T18:00:00Z') ]; let meetingTime = $state<Date | null>(initialTime); let workingHours = $state.raw<RangePickerValue<Date> | null>(initialRange); const [start, end] = $derived(workingHours ?? [null, null]); </script> <Flex vertical gap="medium"> <Flex vertical gap="small" align="start"> <TimePicker aria-label={("Meeting time in UTC")} value={meetingTime} format="HH:mm" inputReadOnly showNow={false} onChange={next => { meetingTime = next; }} /> <output aria-label={("Stored meeting time")}> {meetingTime?.toISOString() ?? '—'} </output> </Flex> <Flex vertical gap="small"> <RangePicker picker="time" value={workingHours} format="HH:mm" showNow={false} placeholder={(["Workday start", "Workday end"])} onChange={next => { workingHours = next; }} /> <output aria-label={("Stored working hours")}> {start?.toISOString() ?? '—'} – {end?.toISOString() ?? '—'} </output> </Flex> </Flex>native-date-adapter.tsimport type { GenerateConfig } from '@woodger/antd'; import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat.js'; import localeData from 'dayjs/plugin/localeData.js'; import utc from 'dayjs/plugin/utc.js'; import weekOfYear from 'dayjs/plugin/weekOfYear.js'; import 'dayjs/locale/de.js'; import 'dayjs/locale/es.js'; import 'dayjs/locale/fr.js'; import 'dayjs/locale/pt-br.js'; import 'dayjs/locale/ru.js'; import 'dayjs/locale/zh-cn.js'; dayjs.extend(customParseFormat); dayjs.extend(localeData); dayjs.extend(utc); dayjs.extend(weekOfYear); const dayjsLocales: Record<string, string> = { de_DE: 'de', en_US: 'en', es_ES: 'es', fr_FR: 'fr', pt_BR: 'pt-br', ru_RU: 'ru', zh_CN: 'zh-cn' }; function localizedDate(locale: string, value = new Date()) { const language = dayjsLocales[locale] ?? 'en'; return dayjs.utc(value).locale(language); } function parseDate(_locale: string, text: string, formats: string[]): Date | null { for (const format of formats) { const parsed = dayjs.utc(text, format, true); if (parsed.isValid()) { return parsed.toDate(); } } return null; } export const nativeDateAdapter: GenerateConfig<Date> = { getNow: () => new Date(), getFixedDate: text => dayjs.utc(text).toDate(), getEndDate: date => dayjs.utc(date).endOf('month').toDate(), getWeekDay: date => date.getUTCDay(), getYear: date => date.getUTCFullYear(), getMonth: date => date.getUTCMonth(), getDate: date => date.getUTCDate(), getHour: date => date.getUTCHours(), getMinute: date => date.getUTCMinutes(), getSecond: date => date.getUTCSeconds(), getMillisecond: date => date.getUTCMilliseconds(), addYear: (date, amount) => dayjs.utc(date).add(amount, 'year').toDate(), addMonth: (date, amount) => dayjs.utc(date).add(amount, 'month').toDate(), addDate: (date, amount) => dayjs.utc(date).add(amount, 'day').toDate(), setYear: (date, year) => dayjs.utc(date).year(year).toDate(), setMonth: (date, month) => dayjs.utc(date).month(month).toDate(), setDate: (date, day) => dayjs.utc(date).date(day).toDate(), setHour: (date, hour) => dayjs.utc(date).hour(hour).toDate(), setMinute: (date, minute) => dayjs.utc(date).minute(minute).toDate(), setSecond: (date, second) => dayjs.utc(date).second(second).toDate(), setMillisecond: (date, millisecond) => dayjs.utc(date).millisecond(millisecond).toDate(), isAfter: (first, second) => first.getTime() > second.getTime(), isValidate: date => Number.isFinite(date.getTime()), locale: { getWeekFirstDay: locale => localizedDate(locale).localeData().firstDayOfWeek(), getWeekFirstDate: (locale, date) => localizedDate(locale, date).startOf('week').toDate(), getWeek: (locale, date) => localizedDate(locale, date).week(), getShortWeekDays: locale => localizedDate(locale).localeData().weekdaysMin(), getShortMonths: locale => localizedDate(locale).localeData().monthsShort(), format: (locale, date, format) => localizedDate(locale, date).format(format), parse: parseDate } };
Three sizes
large, medium and small; size without local prop is inherited from context.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<style>
.example {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
</style>
<div class="example">
{#each ['large', 'medium', 'small'] as const as size (size)}
<TimePicker
aria-label={("TimePicker size " + String((size)) + "")}
{size}
defaultValue={dayjs('2026-10-15T09:30')}
/>
{/each}
</div>
Time confirmation
By default, the time requires OK. needConfirm=false removes the button: the selection is applied without a separate confirmation.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { TimePicker } from '@woodger/antd';
let confirmed = $state<Dayjs | null>(null);
let automatic = $state<Dayjs | null>(null);
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker
aria-label={("Time with confirmation")}
value={confirmed}
format="HH:mm"
needConfirm
defaultOpenValue={dayjs('2026-10-15T09:00')}
showNow={false}
onChange={next => { confirmed = next; }}
/>
<output aria-label={("Confirmed time")}>{(confirmed?.format('HH:mm') ?? 'null')}</output>
<TimePicker
aria-label={("Time without OK button")}
value={automatic}
format="HH:mm"
needConfirm={false}
defaultOpenValue={dayjs('2026-10-15T09:00')}
showNow={false}
onChange={next => { automatic = next; }}
/>
<output aria-label={("Time without confirmation")}>{(automatic?.format('HH:mm') ?? 'null')}</output>
</div>
Inaccessible input
disabled disables the entire field; inputReadOnly disables printing, keeping the selection in the panel.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker
aria-label={("Unavailable time")}
defaultValue={dayjs('2026-10-15T09:30')}
disabled
/>
<TimePicker
aria-label={("Time without manual input")}
defaultValue={dayjs('2026-10-15T09:30')}
inputReadOnly
/>
</div>
Format and columns
HH:mm removes seconds from the panel; HH:mm:ss leaves them. The date format in the value is not serialized.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker
aria-label={("Hours and minutes")}
defaultValue={dayjs('2026-10-15T09:30:56')}
format="HH:mm"
/>
<TimePicker
aria-label={("Hours minutes seconds")}
defaultValue={dayjs('2026-10-15T09:30:56')}
format="HH:mm:ss"
/>
</div>
Time input mask
Enter a time down to the millisecond or set a range in hours and minutes.
<script lang="ts">
import { TimePicker, TimeRangePicker } from '@woodger/antd';
import dayjs from 'dayjs';
</script>
<div class="example">
<TimePicker
aria-label={("Time with milliseconds")}
defaultValue={dayjs('2026-10-15T09:30:00.125')}
format={{ format: 'HH:mm:ss.SSS', type: 'mask' }}
millisecondStep={100}
/>
<TimeRangePicker
format={{ format: 'HH:mm', type: 'mask' }}
placeholder={(["Masked start time", "Masked end time"])}
/>
</div>
<style>
.example {
display: grid;
gap: 16px;
min-width: 0;
}
</style>
Custom time fields
Phones show a numeric keyboard. Enter 1015 to get 10:15.
<script lang="ts">
import {
TimePicker, TimeRangePicker, type DatePickerEditorContext, type RangePickerValue
} from '@woodger/antd';
import dayjs, { type Dayjs } from 'dayjs';
const id = $props.id();
const hoursId = id + '-hours';
const opening = dayjs('2026-10-15T09:00');
const hours: RangePickerValue = [opening, opening.hour(18)];
const format = { format: 'HH:mm', type: 'mask' } as const;
const labels = {
start: ("Business hours start"),
end: ("Business hours end")
};
let openingTime = $state.raw<Dayjs | null>(opening);
</script>
{#snippet editor({ attributes, register, range }: DatePickerEditorContext)}
<input
{...attributes}
aria-label={range ? labels[range] : attributes['aria-label']}
inputmode="numeric"
{@attach register}
/>
{/snippet}
<div class="example">
<div class="field">
<label for={id}>{("Opening time")}</label>
<TimePicker
{id}
{format}
components={{ input: editor }}
value={openingTime}
onChange={value => openingTime = value}
previewValue={false}
/>
<output aria-label={("Confirmed opening time")}>
{openingTime?.format('HH:mm') ?? '—'}
</output>
</div>
<div class="field" role="group" aria-labelledby={hoursId}>
<span id={hoursId}>{("Business hours")}</span>
<TimeRangePicker
{format}
components={{ input: editor }}
defaultValue={hours}
placeholder={[labels.start, labels.end]}
previewValue={false}
/>
</div>
</div>
<style>
.example {
display: grid;
gap: 16px;
max-width: 360px;
}
.field {
display: grid;
gap: 4px;
min-width: 0;
}
output { color: var(--ant-color-text-secondary); }
</style>
Time steps
hourStep=2, minuteStep=15 and secondStep=10 define the available column options.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<TimePicker aria-label={("Time in steps")} defaultValue={dayjs('2026-10-15T10:30:20')}
hourStep={2} minuteStep={15} secondStep={10} />
Explanation in the panel
renderExtraFooter receives the current panel mode. In time mode, it shows a time zone note.
<script lang="ts">
import { TimePicker } from '@woodger/antd';
import dayjs from 'dayjs';
</script>
<TimePicker
aria-label={("Time with explanation")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
>
{#snippet renderExtraFooter(mode)}
{#if mode === 'time'}
<span>{("All times are in your local time zone.")}</span>
{/if}
{/snippet}
</TimePicker>
12 hour format
use12Hours and the h:mm a format add a period of day; Russian locale shows it in Russian. The model stores the same time, the output next to it uses HH:mm.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { TimePicker } from '@woodger/antd';
let value = $state<Dayjs | null>(dayjs('2026-10-15T13:30'));
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker
aria-label={("Twelve hour format")}
{value}
use12Hours
format="h:mm a"
onChange={next => { value = next; }}
/>
<output aria-label={("Time in 24-hour format")}>{(value?.format('HH:mm') ?? 'null')}</output>
</div>
Change by scroll
changeOnScroll selects the closest valid value after the column stops. Without needConfirm it is applied without OK.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { TimePicker } from '@woodger/antd';
let value = $state<Dayjs | null>(dayjs('2026-10-15T09:00'));
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker aria-label={("Time scrolling")} {value} format="HH:mm" minuteStep={15}
changeOnScroll needConfirm={false} showNow={false}
onChange={next => { value = next; }} />
<output aria-label={("Time after scrolling")}>{(value?.format('HH:mm') ?? 'null')}</output>
</div>
Time range
TimeRangePicker is exported separately. Every boundary is confirmed; the result is a pair of Dayjs or null.
<script lang="ts">
import dayjs from 'dayjs';
import { TimeRangePicker, type RangePickerValue } from '@woodger/antd';
let value = $state<RangePickerValue | null>(null);
</script>
<style>
.example {
display: grid;
gap: 16px;
}
output {
overflow-wrap: anywhere;
}
</style>
<div class="example">
<TimeRangePicker {value} format="HH:mm" minuteStep={15} style="width:100%" showNow={false}
placeholder={(["Start of time interval", "End of time interval"])}
defaultOpenValue={[dayjs('2026-10-15T09:00'), dayjs('2026-10-15T18:00')]}
onChange={next => { value = next; }} />
<output aria-label={("Time interval")}>{(value?.map(
date => date?.format('HH:mm') ?? '—'
).join(' — ') ?? 'null')}</output>
</div>
Design options
outlined, filled, borderless and underlined.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
{#each ['outlined', 'filled', 'borderless', 'underlined'] as const as variant (variant)}
<TimePicker
aria-label={("TimePicker option " + String((variant)) + "")}
{variant}
defaultValue={dayjs('2026-10-15T09:30')}
/>
{/each}
</div>
Test states
Error and warning for single time and range.
<script lang="ts">
import { TimePicker, TimeRangePicker } from '@woodger/antd';
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
{#each ['error', 'warning'] as const as status (status)}
<TimePicker aria-label={("TimePicker Status " + String((status)) + "")} {status} />
<TimeRangePicker {status} style="width:100%" placeholder={([
`Start time ${status}`,
`End time ${status}`
])} />
{/each}
</div>
Prefix, suffix and clearing
Text and Svelte snippets for prefix/suffixIcon. allowClear.clearIcon replaces the clear icon.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker
aria-label={("Time with icons")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
prefix="◷"
suffixIcon="↓"
allowClear={{ clearIcon: '×' }}
/>
<TimePicker
aria-label={("Time with snippet")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
>
{#snippet prefix()}<span aria-hidden="true">◴</span>{/snippet}
{#snippet suffixIcon()}<span aria-hidden="true">⌄</span>{/snippet}
</TimePicker>
</div>
Semantic styles
The styles object and function design the real slots fields and popups for both components.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker, TimeRangePicker } from '@woodger/antd';
</script>
<style>
.example {
display: grid;
gap: 16px;
}
</style>
<div class="example">
<TimePicker
aria-label={("Semantic TimePicker")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
classNames={{ root: 'time-picker-semantic-root' }}
styles={({ props }) => ({
root: `border:2px dashed ${props.variant === 'outlined' ? '#722ed1' : '#52c41a'}`,
popup: {
root: 'outline:2px solid #722ed1',
item: 'font-weight:600'
}
})}
/>
<TimeRangePicker style="width:100%" format="HH:mm" placeholder={([
"Semantic beginning",
"Semantic end"
])}
styles={{
root: 'border:2px dashed #52c41a',
popup: { footer: 'font-weight:600' }
}} />
</div>
Time restrictions
Working hours and available minutes are dependent on each other. hideDisabledOptions hides excluded options.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<TimePicker
aria-label={("Permitted working hours")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
minuteStep={15}
hideDisabledOptions
disabledTime={() => ({
disabledHours: () => [...Array.from({ length: 9 }, (_, hour) => hour), 18, 19, 20, 21, 22, 23],
disabledMinutes: hour => hour === 9 ? [0, 15] : []
})}
/>
Own panel and cells
cellRender saves the original native button via originNode; panelRender wraps a standard panel. Preset sets the lunch time.
<script lang="ts">
import dayjs from 'dayjs';
import { TimePicker } from '@woodger/antd';
</script>
<TimePicker
aria-label={("Your own time panel")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
minuteStep={15}
presets={([{ label: "Lunch", value: dayjs('2026-10-15T12:00') }])}
>
{#snippet cellRender(value, info)}
<span style={info.subType === 'minute' && value === 30
? `
color: #722ed1;
font-weight: 700;
`
: undefined}>
{@render info.originNode()}
</span>
{/snippet}
{#snippet panelRender(panel)}
<div style="
display: grid;
gap: 12px;
">
<strong style="padding:12px 12px 0">{("Meeting time")}</strong>
{@render panel()}
</div>
{/snippet}
</TimePicker>
Appointment schedule
Choose an appointment time or a time range. There is a break at 12:00.
<script lang="ts">
import {
Button, TimePicker, TimeRangePicker, type DatePickerPanelContext, type RangePickerValue
} from '@woodger/antd';
import dayjs, { type Dayjs } from 'dayjs';
const first = dayjs('2026-10-15T09:00');
const interval: RangePickerValue = [first, first.hour(16)];
const hours = [8, 9, 12, 16, 18];
const labels = {
start: ("Appointment start"),
end: ("Appointment end")
};
const lunchBreak = { disabledHours: () => [12] };
let accepted = $state.raw<Dayjs | null>(first);
</script>
{#snippet options(panel: DatePickerPanelContext)}
{@const label = panel.range ? labels[panel.range] : ("Time options")}
<div class="time-panel" role="group" aria-label={label}>
{#each hours as hour (hour)}
{@const time = panel.pickerValue.startOf('day').hour(hour)}
{@const unavailable = panel.showTime?.disabledTime?.(time).disabledHours?.()}
{@const selected = panel.value?.isSame(time, 'minute') ?? false}
<Button
type={selected ? 'primary' : 'default'}
size="small"
aria-pressed={selected}
disabled={unavailable?.includes(hour) || panel.disabledDate(time, { type: 'time' })}
onclick={() => panel.onSelect(time)}
>{time.format('HH:mm')}</Button>
{/each}
</div>
{/snippet}
<div class="fields">
<TimePicker
aria-label={("Appointment time")}
value={accepted}
onChange={value => accepted = value}
format="HH:mm"
needConfirm
showNow={false}
disabledTime={() => lunchBreak}
components={{ time: options }}
/>
<output aria-label={("Confirmed appointment time")}>
{accepted?.format('HH:mm') ?? '—'}
</output>
<TimeRangePicker
defaultValue={interval}
placeholder={[labels.start, labels.end]}
format="HH:mm"
needConfirm
showNow={false}
disabledTime={() => lunchBreak}
components={{ time: options }}
/>
</div>
<style>
.fields {
display: grid;
gap: 12px;
max-width: 360px;
}
.fields output { color: var(--ant-color-text-secondary); }
.time-panel {
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
gap: 8px;
width: min(256px, calc(100vw - 32px));
padding: 12px;
}
</style>
Time in Form
Mandatory field, send and reset. Form stores Dayjs, formatting is only needed to display the result.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { Button, Form, FormItem, TimePicker, createForm } from '@woodger/antd';
const form = createForm<{ time: Dayjs | null }>({
initialValues: { time: null },
rules: ({ time: [{ required: true, message: "Select the call time." }] })
});
let result = $state('—');
</script>
<style>.actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
} output {
display: block;
margin-top: 16px;
}</style>
<Form {form} onFinish={values => {
result = ("" + String((dayjs.isDayjs(values.time) ? 'Dayjs' : ("Not Dayjs"))) + ": " + String((values.time?.format('HH:mm') ?? 'null')) + "");
}}>
<FormItem name="time" label={("Call time")}>
<TimePicker aria-label={("Call time")} value={form.values.time} format="HH:mm"
defaultOpenValue={dayjs('2026-10-15T09:00')} showNow={false}
onChange={next => form.setFieldValue('time', next)} />
</FormItem>
<div class="actions">
<Button htmlType="submit" type="primary">{("Save call")}</Button>
<Button
htmlType="reset"
onclick={() => { result = '—'; }}
>{("Reset call")}</Button>
</div>
</Form>
<output aria-label={("Time form result")}>{result}</output>
Meeting and work slot
Example from the review saved: single time and range with associated values.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import { TimePicker, TimeRangePicker, type RangePickerValue } from '@woodger/antd';
let time = $state<Dayjs | null>(dayjs('2026-10-29T09:30:00'));
let range = $state<RangePickerValue | null>([
dayjs('2026-10-29T10:00:00'),
dayjs('2026-10-29T12:00:00')
]);
</script>
<style>
.example {
display: grid;
gap: 16px;
max-width: 640px;
}
.field {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
output { display: block; }
</style>
<div class="example">
<div class="field">
<label for="showcase-time">{("Meeting time")}</label>
<TimePicker
id="showcase-time"
value={time}
format="HH:mm"
minuteStep={15}
allowClear
onChange={next => { time = next; }}
/>
</div>
<output aria-label={("Selected time")}>{(time?.format('HH:mm') ?? "No time selected")}</output>
<div class="field">
<span>{("Operating time")}</span>
<TimeRangePicker
value={range}
format="HH:mm"
minuteStep={15}
placeholder={(["Getting started", "End of work"])}
allowClear
style="max-width:100%"
onChange={next => { range = next; }}
/>
</div>
<output aria-label={("Selected time range")}>{(range?.map(
value => value?.format('HH:mm') ?? '—'
).join(' — ') ?? "Range not selected")}</output>
</div>
Select part of the time you typed or choose a minute before pressing OK. Changing the prefix keeps the input, selection and pending time in both pickers.
CSS time prefixes
Change prefixes in a controlled TimePicker and TimeRangePicker, with RTL and CSS variables.
<script lang="ts">
import dayjs, { type Dayjs } from 'dayjs';
import {
Checkbox, ConfigProvider, TimePicker, TimeRangePicker,
type RangePickerValue, type TimePickerCellRenderInfo
} from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
let rtl = $state(false);
let withVariables = $state(false);
let value = $state.raw<Dayjs | null>(dayjs('2026-10-15T09:30'));
let range = $state.raw<RangePickerValue | null>([
dayjs('2026-10-15T09:30'), dayjs('2026-10-15T18:00')
]);
let changes = $state(0);
let rangeChanges = $state(0);
const prefix = $derived(custom ? 'suite' : 'ant');
const localPrefix = $derived(local ? 'project-picker' : '');
</script>
<style>
.example,
section {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
{#snippet original(_value: number | 'am' | 'pm', info: TimePickerCellRenderInfo)}
<span data-render-prefix={info.prefixCls}>{@render info.originNode()}</span>
{/snippet}
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("Common prefix TimePicker suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local prefix TimePicker")}</Checkbox>
<Checkbox bind:checked={rtl}>{("RTL TimePicker with prefix")}</Checkbox>
<Checkbox bind:checked={withVariables}>CSS variables TimePicker</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} direction={rtl ? 'rtl' : 'ltr'}
theme={withVariables ? { cssVar: { prefix: 'times-theme' } } : undefined}>
<section aria-label={("Single time with prefix")}>
<TimePicker
prefixCls={localPrefix}
class="prefix-time-main"
id="prefix-time"
aria-label={("Time with CSS prefix")}
{value}
format="HH:mm"
minuteStep={5}
showNow={false}
cellRender={original}
onChange={next => {
value = next;
changes++;
}}
/>
<output aria-label={("Time with prefix")}>{(value?.format('HH:mm') ?? 'null')}</output>
<output aria-label={("Time changes with prefix")}>{("Changes: ")}{changes}</output>
</section>
<section aria-label={("Time range with prefix")}>
<TimeRangePicker
prefixCls={localPrefix}
class="prefix-time-range"
style="width:100%"
id={{ start: 'prefix-time-start', end: 'prefix-time-end' }}
value={range}
format="HH:mm"
minuteStep={5}
showNow={false}
cellRender={original}
placeholder={(["Start time with prefix", "End of time with prefix"])}
onChange={next => {
range = next;
rangeChanges++;
}}
/>
<output aria-label={("Time range with CSS prefix")}>
{(range?.map(item => item?.format('HH:mm') ?? '—').join(' — ') ?? 'null')}
</output>
<output aria-label={("Changes time range with prefix")}>{("Changes: ")}{rangeChanges}</output>
</section>
</ConfigProvider>
<output aria-label={("CSS prefix TimePicker")}>Picker: {(localPrefix
|| prefix + '-picker')}</output>
<p>
{("Select part of the time you typed or choose a minute before pressing OK.")}
{("Changing the prefix keeps the input, selection and pending time in both pickers.")}
</p>
</div>
Coverage Examples
15 main themes of live page ant.design 6.7 are compared. In Svelte, the range is exported as a TimeRangePicker, the rendering functions are replaced by snippets. The exact contract is specified by the public types of the package.
| Theme | Example Svelte |
|---|---|
| Basic | Base time |
| Multiple | Multiple time selection |
| Under Control | Controlled time |
| Three Sizes | Three sizes |
| Need Confirm | Time confirmation |
| disabled | Inaccessible input |
| Hour and minute | Format and columns |
| interval option | Time steps |
| Addon | Explanation in the panel |
| 12 hours | 12 hour format |
| Change on scroll | Change by scroll |
| Time Range Picker | Time range |
| Variants | Design options |
| Status | Test states |
| Prefix and Suffix | Prefix, suffix and clearing |
| Custom semantic dom styling | Semantic styles |
API
The standard TimePicker takes Dayjs or null. Your application chooses the time zone. The component supports standard input attributes and exposes separate callbacks for time selection.
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full prefix of the field, popup and time columns; empty string/undefined selects a common prefix with -picker. The OK button inherits a separate Button prefix. | string | General prefix + -picker |
multiple | Selects several times. | boolean | false |
value | Controlled time via onChange. With multiple, pass an array of Dayjs dates. | Dayjs | readonly Dayjs[] | null | undefined |
components | Replaces the input or the contents of the panel for a given mode. | DatePickerComponents | undefined |
defaultValue | Initial local time. | Dayjs | readonly Dayjs[] | null | undefined |
format | Sets the display format and panel columns. An object with type=mask enables segmented input. | DatePickerFormat | DatePickerFormat[] | DatePickerFormatConfig | HH:mm:ss / h:mm:ss a |
use12Hours | Adds a 12-hour cycle and localized period of day (AM/PM in enUS). | boolean | false |
needConfirm | The draft is published after confirmation OK. false allows use without a separate button. | boolean | true |
defaultOpenValue | Initial panel candidate; the field itself remains empty until selected. | Dayjs | undefined |
hourStep | Clock pitch. minuteStep, secondStep and millisecondStep control their own columns. | number | 1 |
showMillisecond | Milliseconds column; coordinate the value format with the required accuracy. | boolean | From format |
changeOnScroll | Selects the nearest allowed option 300 ms after manual scrolling. | boolean | false |
disabledTime | Hours, minutes, seconds and milliseconds with dependencies on the units already selected. | (date) => DatePickerDisabledTime | undefined |
hideDisabledOptions | Hides excluded options instead of showing disabled. | boolean | false |
previewValue | Pre-hover text without onChange. | false | hover | hover |
onChange | Committed time and its text. With multiple, both arguments are arrays. Clearing the field passes null for both arguments. | TimePickerProps["onChange"] | TimePickerMultipleProps["onChange"] | — |
onCalendarChange | Draft. SinglePicker does not pass the range field. | (value, text, info: {}) => void | — |
onKeyDown | Native keyboard event. To cancel the action, call event.preventDefault(); TimeRangePicker has the same signature. | (event: KeyboardEvent) => void | — |
onOk | The OK button passes the draft before onChange and before the popup closes. With multiple, the draft is an array of times. | TimePickerProps["onOk"] | TimePickerMultipleProps["onOk"] | — |
allowClear | allowClear.clearIcon sets the clearing icon. Disable clearing - allowClear=false. | boolean | { clearIcon?: TimePickerContent } | true |
open | Visibility control via onOpenChange; defaultOpen sets the initial one. | boolean | Local |
inputReadOnly | Blocks typing in a plain field. With a mask, the keyboard can still change the value. | boolean | false |
autoFocus | Focuses the editor when it appears. A range focuses the first enabled field. | boolean | false |
tabIndex | Sets the tab order for the field. | number | undefined |
autoComplete | Controls browser autocomplete for the field. | HTMLInputAttributes["autocomplete"] | off |
renderExtraFooter | Renders content at the bottom of the panel and receives its current mode. | Snippet<[Mode]> | undefined |
prefix | Prefix: text, number, snippet or null. | TimePickerContent | undefined |
suffixIcon | true saves the clock; null or an empty string removes the suffix. | TimePickerContent | true | Clock icon |
presets | Ready time as Dayjs or callback; label - text or snippet. | readonly TimePickerPreset[] | undefined |
cellRender | info contains subType, resolved by prefixCls and originNode - snippet of the native button with the same prefix. | Snippet<[number | am | pm, TimePickerCellRenderInfo]> | Standard cell |
panelRender | Wraps the standard composition, saving the lifecycle popup. | Snippet<[Snippet]> | Standard panel |
classNames | Classes semantic slots; object or function with props. | TimePickerSemantic | undefined |
styles | CSS strings and objects for the field and popup parts. | TimePickerProps["styles"] | TimePickerMultipleProps["styles"] | undefined |
size | large, medium and small. | ComponentSize | From context |
variant | Local variant → closest Form.variant → ConfigProvider.timePicker.variant → general ConfigProvider.variant → outlined. TimeRangePicker uses rangePicker.variant. | outlined | filled | borderless | underlined | From context / outlined |
status | Check status. | error | warning | success | validating | From FormItem |
locale | General calendar dictionary and timePickerLocale for hints. | DatePickerLocale | From context |
popupAlign | Overrides anchor points, offsets and overflow settings for the selected placement. | DatePickerPopupAlign | — |
builtinPlacements | Replaces the placement map for the panel. | Readonly<Record<string, DatePickerPopupAlign>> | Built-in map |
transitionName | Name of the popup CSS animation. | string | Component animation |
getPopupContainer | Container popup; placement specifies the preferred position. | (trigger) => HTMLElement | ShadowRoot | From ConfigProvider |
TimeRangePicker API
TimeRangePicker is exported separately and inherits the time settings. Additional differences are listed below. When needConfirm=true, each boundary is confirmed separately.
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Local owner of both fields, the common panel and columns. cellRender gets it via info.prefixCls; OK button and CSS variables are resolved independently. | string | General prefix + -picker |
value | A couple of times. Callback returns RangePickerValue or null. | RangePickerInputValue | null | undefined |
components | Replaces the input or the contents of the panel for a given mode. | DatePickerComponents | undefined |
defaultOpenValue | One candidate to start with or separate ones for both boundaries. | Dayjs | [Dayjs, Dayjs] | undefined |
disabled | Disabling both or individual borders. | boolean | [boolean, boolean] | From context |
allowEmpty | Allowed empty boundaries. | boolean | [boolean, boolean] | false |
order | Arranging selected times. | boolean | true |
onChange | Confirmed pair; when fully cleared, both arguments are null. | (value, [string, string] | null) => void | — |
onCalendarChange | Draft with start/end. | (value, texts, { range }) => void | — |
disabledTime | Constraints with the context of another boundary. | (date, start | end, { from? }) => DatePickerDisabledTime | undefined |
renderExtraFooter | Renders content at the bottom of the panel and receives its current mode. | Snippet<[Mode]> | undefined |
placeholder | General or individual tips. | string | [string, string] | From locale |
autoFocus | Focuses the editor when it appears. A range focuses the first enabled field. | boolean | false |
tabIndex | Sets the tab order for the field. | number | undefined |
autoComplete | Controls browser autocomplete for the field. | HTMLInputAttributes["autocomplete"] | off |
styles | CSS strings and objects for the field and popup parts. A styles function receives the range picker props. | TimeRangePickerProps["styles"] | undefined |
For individual label, set id.start/id.end. onfocus/onblur or compatible onFocus/onBlur events receive info.range. The local semantic callback accepts range props, and ConfigProvider.timePicker specifies the overall configuration of both components.
Methods
focus() and blur() are available through bind:this. Focus accepts preventScroll and cursor=start/end/all; for TimeRangePicker index=0/1 selects the border. bind:nativeElement returns the root div, bind:startInput/endInput of the range - native input elements.
<script lang="ts">
import dayjs from 'dayjs';
import { Button, TimePicker, TimeRangePicker } from '@woodger/antd';
let single = $state<ReturnType<typeof TimePicker>>();
let range = $state<ReturnType<typeof TimeRangePicker>>();
</script>
<style>.example {
display: grid;
gap: 16px;
} .actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}</style>
<div class="example">
<TimePicker
bind:this={single}
aria-label={("TimePicker Methods")}
format="HH:mm"
defaultValue={dayjs('2026-10-15T09:30')}
/>
<TimeRangePicker bind:this={range} format="HH:mm" style="width:100%"
defaultValue={[dayjs('2026-10-15T09:00'), dayjs('2026-10-15T18:00')]}
placeholder={(["Start time methods", "Time methods end"])} />
<div class="actions">
<Button
onclick={() => single?.focus({ cursor: 'all' })}
>{("Focus TimePicker")}</Button>
<Button onclick={() => single?.blur()}>{("Remove Focus TimePicker")}</Button>
<Button
onclick={() => range?.focus({ index: 1 })}
>{("End Focus TimeRangePicker")}</Button>
</div>
</div>
Semantic DOM
Input has the role of combobox and is associated with the dialog panel. The down arrow moves focus to a column; arrows, Home/End move selection, Enter confirms, Escape cancels open interaction.
Select slot to highlight the current item. For popup, the panel will open automatically.
| Slot | Purpose |
|---|---|
root | Root wrapper of the field. |
prefix | Prefix. |
input | Native input; y range applies to both. |
suffix | Suffix. |
popup | Root, content, item, footer and container panels; line is equivalent to popup.root. |
styles contains CSS strings. styles.popup has root, content, item, footer and container available; classNames has the same nested form. cellRender must save the originNode so as not to lose the native button and its keyboard.
Registration tokens
The official TimePicker and DatePicker tables are the same: 40 component and 69 common tokens. In the package, the component map is called DatePicker. TimePicker/TimeRangePicker apply theme.components.DatePicker to the field and timebar. Semantic styles and ConfigProvider.timePicker specify local styling.
| Token | Purpose |
|---|---|
activeBg | Active field background. |
activeBorderColor | Active frame. |
activeShadow | Focus shadow. |
addonBg | Background of the additional area. |
cellActiveWithRangeBg | Selected range. |
cellBgDisabled | Unavailable day background. |
cellHeight | Cell height. |
cellHoverBg | Targeting a cell. |
cellHoverWithRangeBg | Preliminary range. |
cellRangeBorderColor | Range frame. |
cellWidth | Cell width. |
errorActiveShadow | Error shadow. |
hoverBg | Field background when hovering. |
hoverBorderColor | Hover frame. |
inputFontSize | Middle field text. |
inputFontSizeLG | Large field text. |
inputFontSizeSM | Small field text. |
multipleItemBg | Multiple tag background. |
multipleItemBorderColor | Multiple tag frame. |
multipleItemBorderColorDisabled | Inaccessible multiple tag frame. |
multipleItemColorDisabled | Inaccessible multiple tag text. |
multipleItemHeight | Height of multiple tag. |
multipleItemHeightLG | Large multiple tag. |
multipleItemHeightSM | Small multiple tag. |
multipleSelectorBgDisabled | Inaccessible multiple-selector. |
paddingBlock | Vertical offset. |
paddingBlockLG | Large margin indent. |
paddingBlockSM | Small margin indent. |
paddingInline | Horizontal offset. |
paddingInlineLG | Large margin indent. |
paddingInlineSM | Small margin indent. |
presetsMaxWidth | Maximum width of presets. |
presetsWidth | Width presets. |
textHeight | Text height. |
timeCellHeight | Time variant height. |
timeColumnHeight | Height of the time column. |
timeColumnWidth | Time column width. |
warningActiveShadow | Shadow warning. |
withoutTimeCellHeight | Day altitude without time. |
zIndexPopup | Layer popup. |
Common tokens of the current topic
The values are read through theme.useToken() and react to the theme settings in the header.
| Token | Meaning |
|---|---|
colorBgContainer | #ffffff |
colorBgContainerDisabled | rgba(0,0,0,0.04) |
colorBgElevated | #ffffff |
colorBorder | #d9d9d9 |
colorBorderDisabled | #d9d9d9 |
colorError | #ff4d4f |
colorErrorAffix | #ff4d4f |
colorErrorBg | #fff2f0 |
colorErrorBgHover | #fff1f0 |
colorErrorBorderHover | #ffa39e |
colorErrorText | #ff4d4f |
colorFillSecondary | rgba(0,0,0,0.06) |
colorFillTertiary | rgba(0,0,0,0.04) |
colorIcon | rgba(0,0,0,0.45) |
colorIconHover | rgba(0,0,0,0.88) |
colorLink | #1677ff |
colorLinkActive | #0958d9 |
colorLinkHover | #69b1ff |
colorPrimary | #2f54eb |
colorPrimaryBorder | #adc6ff |
colorSplit | rgba(5,5,5,0.06) |
colorText | rgba(0,0,0,0.88) |
colorTextDisabled | rgba(0,0,0,0.25) |
colorTextHeading | rgba(0,0,0,0.88) |
colorTextLightSolid | #fff |
colorTextPlaceholder | rgba(0,0,0,0.25) |
colorTextQuaternary | rgba(0,0,0,0.25) |
colorTextTertiary | rgba(0,0,0,0.45) |
colorWarning | #faad14 |
colorWarningAffix | #faad14 |
colorWarningBg | #fffbe6 |
colorWarningBgHover | #fff1b8 |
colorWarningBorderHover | #ffd666 |
colorWarningText | #faad14 |
borderRadius | 6 |
borderRadiusLG | 8 |
borderRadiusSM | 4 |
borderRadiusXS | 2 |
boxShadowSecondary |
0 6px 16px 0 rgba(0,0,0,0.08),
0 3px 6px -4px rgba(0,0,0,0.12),
0 9px 28px 8px rgba(0,0,0,0.05)
|
controlHeight | 32 |
controlHeightLG | 40 |
controlHeightSM | 24 |
controlItemBgActive | #f0f5ff |
fontFamily | -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji' |
fontSize | 14 |
fontSizeLG | 16 |
fontSizeSM | 12 |
fontWeightStrong | 600 |
lineHeight | 1.5714285714285714 |
lineHeightLG | 1.5 |
lineType | solid |
lineWidth | 1 |
lineWidthBold | 2 |
linkDecoration | none |
linkFocusDecoration | none |
linkHoverDecoration | none |
marginXS | 8 |
marginXXS | 4 |
motionDurationMid | 0.2s |
motionDurationSlow | 0.3s |
motionEaseInOutCirc | cubic-bezier(0.78, 0.14, 0.15, 0.86) |
motionEaseInQuint | cubic-bezier(0.755, 0.05, 0.855, 0.06) |
motionEaseOutCirc | cubic-bezier(0.08, 0.82, 0.17, 1) |
motionEaseOutQuint | cubic-bezier(0.23, 1, 0.32, 1) |
padding | 16 |
paddingSM | 12 |
paddingXS | 8 |
paddingXXS | 4 |
sizePopupArrow | 16 |
ConfigProvider.timePicker
The general configuration specifies class, style, variant, classNames/styles, suffixIcon and cleanup. Local props take precedence; the nested timePicker object replaces the entire parent.
<script lang="ts">
import dayjs from 'dayjs';
import { ConfigProvider, TimePicker } from '@woodger/antd';
</script>
<ConfigProvider timePicker={{
variant: 'filled', suffixIcon: '◷', styles: {
root: 'border:2px solid #722ed1'
}
}}>
<TimePicker
aria-label={("Time from ConfigProvider")}
defaultValue={dayjs('2026-10-15T09:30')}
format="HH:mm"
/>
</ConfigProvider>
FAQ
Why is the model still the same after selecting a column?
By default needConfirm=true. Confirm OK or use needConfirm=false. Intermediate selection is available via onCalendarChange.
How to leave only hours and minutes?
Pass format=HH:mm. Explicit showHour/showMinute/showSecond can separately override the composition of the panel.
How to limit the end of the interval?
Return constraints from disabledTime given partial=start/end and info.from. The model remains a pair of Dayjs.
Why does the text change when you hover, but not the result?
This is previewValue=hover. It doesn't publish the selection; false disables browsing, and changeOnScroll separately enables scroll selection.
How to replace the React render function?
cellRender and panelRender accept Svelte snippets. Save info.originNode and the standard panel snippet, as in the custom panel example.
Is it possible to pass Date or Moment instead of Dayjs?
Create the fields with DatePicker.generatePicker(adapter). Use the returned TimePicker for a single time or RangePicker with picker="time" for an interval. In the JavaScript Date example, both fields store Date objects and show time in UTC. The DatePicker guide describes what the adapter provides.
When does the value of a controlled range change?
Choose a minute in the prefix example. While the panel is open, the output below the fields still shows the previous range. If the application changes the prefix, the pending minute selection stays in place. Press OK and onChange receives the new pair. The controlled range example shows how to store it.