生态产品多个设计器现已发布正式版

查看生态总览
跳转到内容

TimePicker 时间选择器 ​

将可键入的分段时间框、时钟触发器和分列选择浮层组合成一个字段。

用法 ​

输入框与选择面板共享同一份值;按 15 分钟列出选项并实时显示结果

09:30
当前值:09:30

组件结构 ​

加粗的是必需部件。

data-scope="time-picker":root · label · control · tag-list · segment-group · segment · trigger · clear-trigger · positioner · content · preset-group · preset · column · item · footer · confirm-trigger · hidden-input

示例 ​

按单位步长 ​

timeStep 给时、分、秒各设步长,{ minute: 15 } 只裁剪浮层中的可选值(分列剩四格),段位上手动输入的分钟数不受它限制

09:30
当前值:09:30

12 小时制 ​

时列写的是显示值 01-12,落到哪个真实小时由上下午决定:输入行中输入、浮层中选择都会修改它

09:30上午
值仍是 24 小时的串:09:30

精度到秒 ​

granularity 同时决定输入行显示几段、浮层中排几列

--:--:--
当前值:(空)

禁用 / 只读 / 校验失败 ​

禁用整条退出 Tab 序列,只读仍能展开浏览只是不可修改值,invalid 只改变标注

09:30
09:30
09:30

可选时段 ​

min / max 直接把界外的格从列中裁掉;分列还会随已选的小时再裁剪一次

--:--
手打进段位的时间不受裁剪限制,越界只被标注:(空)

浮层中的操作按钮 ​

列表下方这排按钮是作者自己的节点,键盘事件在这一层收口,不再上交给列表

--:--
当前值:(空)

自定义可选格 ​

列中渲染哪几格由作者决定,午休两格整段移除;手动输入段位的小时被吸附到下一个可约小时

09:00
当前值:09:00

三轴 ​

variant 决定描边与底色的绘制方式、tone 决定使用哪族颜色、size 切换几何档;三者只落在 root,浮层中的格子一并随之变化

09:30
09:30
09:30
09:30
09:30
09:30
09:30
09:30
09:30

可选的触发按钮 ​

点击输入行本来就会展开,该按钮不是必需的;需要它是因为它才带 aria-haspopup / aria-expanded

09:30
当前值:09:30

快捷选项 ​

presets 在列旁边多排一列,点击一条即整份写入值并收起;时刻在组件外计算后再传入

--:--
当前值:(空)

按已选的时判定 ​

isTimeUnavailable 的第三个参数带已选的时:9 点只能约 30 分以后,别的整点不受限

09:30
当前值:09:30

多选成标签 ​

selectionMode="multiple" 时各列拼出的是草稿,按「添加」收进值、浮层不收,可以接着添;选中的时刻在输入行里排成标签,点叉或在展开钮上按退格摘掉

09:0014:30
当前值:09:00、14:30

设计指引 ​

何时使用 ​

  • 可选时间是离散的(每 15 分钟一档)。
  • 需要限制可选时段(营业时间、可预约时段)。

何时不用 ​

  • 任意时间都可以、用户直接键入时,使用时间字段。

特性 ​

  • 不写结构时按标准结构铺出整套部件(Vue 不写默认插槽、React 不给 children、Web Components 不写部件或只写 root),三端出自同一个结构函数:标题(label 给文字,是原生 label),盒里的段组(时、分、秒之间是冒号,挨着上下午段的是空格;多选时换成带删除钮的标签行)、清空钮与日历钮,表单影子,浮层里依次是快捷选项列、按精度与小时制铺的各列,多选时再加底栏的「添加」(文字取 translations.confirmTrigger)。精度、小时制与选中变化时结构随之重铺。Web Components 里标题可以写在宿主的直接子节点上接管:slot="label"。
  • timeStep 按单位设定时、分、秒各列的步长({ minute: 15 })。
  • max 直接把界外的格从列中裁掉;分钟列还会随已选的小时再裁一次。
  • isTimeUnavailable 逐格判断可选性:时列按 24 小时制给值,第三个参数带已选的时与分,写得出「9 点只能选 30 分以后」。
  • 浮层内可以放置“当前时刻”与确认按钮。
  • 值恒为 ISO 时间串数组:单选至多一项(还没填全时为空数组),宿主可以写裸串;onValueChange 的 value 恒为数组。
  • 多选(selectionMode="multiple")时各列拼出的是草稿,按「添加」(confirm-trigger)收进值,浮层不收、草稿留着,改一列就能接着添;快捷选项点一下切换选中。草稿没填全、越界、已经选过或到了 maxSelected 时「添加」不可按。
  • 「添加」写在底栏(footer)里:底栏是浮层底部的通栏操作区,落在快捷选项列与各列下面独占一行,上沿一道分隔线、四周 8 的内衬;作者另放的说明文字排在行首、取弱化的说明档字,「添加」落在行尾。底栏里只有「添加」时,单选下它随「添加」一并收起,不留空栏。
  • 多选的选中值在输入行里排成标签(与选择器多选同一套库内标签),按时刻升序:段位收起,展开钮常驻并成为键盘入口,在它上面按退格摘掉最后一个,点标签上的叉摘掉那一个;标签按 locale 与小时制排出(13:45、下午1:45),不截短、一行放不下就折行,超过 maxTagCount(默认 3)的折进 +N;表单一个选中值一份同名隐藏输入。
  • 触发器打开空值时焦点直接落到第一项;从输入段打开时继续保留键入焦点。
  • 快捷选项与时/分/秒列都从当前值恢复持久选中,并在逻辑末端显示对号。
  • 悬停、键盘高亮与可见焦点使用中性实体底,与选中对号可以同时存在。数字格在左右保留等宽标记轨,选中和 RTL 都不会把数字推离中心。
  • 每列 64px 宽、七格整行高,格是 24px 高的通栏条;列底留白让末尾几格(23 时、55–59 分)也能滚到列顶,几列的选中落在同一行。快捷选项是淡底小钮,选中时在末端画对号。
  • 输入框走 Field Chrome 描边式;浮层为 floating 实体面(border-default + floating 海拔);时分秒与快捷列各自接自绘条。
  • 浮层走弹层那一套进出场:按实际弹出方向短移、淡入放大,退场缩小淡出;减弱动效和增强对比度沿用主题设置。
  • 空值时显示时钟入口;有值且渲染了清空按钮时,指针落在盒上(或焦点在盒内)由清空按钮原位接替时钟图标,触屏上有值即接替;焦点正在时钟钮上时它不让位。
  • 聚焦边界与当前段位使用短过渡,不以瞬时跳色表达焦点。

组合 ​

  • 与日期选择器配合组成日期时间选择。
  • 直接放入表单字段:字段的标题并进时钟钮的名字,说明与错误文案进描述链;只读、必填与校验由各段报告,时钟钮是普通按钮,不带 aria-readonly / aria-required。有值时清空钮顶替时钟钮,点字段标题焦点落在第一段。

最佳实践 ​

  • 把不可选的时段裁掉而不是置灰,列更短、查找更快。
  • 打开时把浮层滚动到当前值。
  • 标准输入行应同时包含清空按钮与时钟图标触发器;单选时二者按值互斥显示,多选时都留着。参与表单时同时渲染隐藏输入。
  • 自定义格内文案保持简短;选中对号由皮肤统一绘制,不在插槽内重复添加。
  • 多选时把「添加」放进底栏,不在 content 里另写带样式的包裹块。

反模式 ​

  • 步长设为 1 分钟:一列六十格,滚动过长。

API 参考 ​

产物 ​

层值
自定义元素<xh-time-picker>
Vue 组件XhTimePickerClearTrigger XhTimePickerColumn XhTimePickerConfirmTrigger XhTimePickerContent XhTimePickerControl XhTimePickerFooter XhTimePickerHiddenInput XhTimePickerItem XhTimePickerItemDeleteTrigger XhTimePickerLabel XhTimePickerOverflowTag XhTimePickerPositioner XhTimePickerPreset XhTimePickerPresetGroup XhTimePickerRoot XhTimePickerSegment XhTimePickerSegmentGroup XhTimePickerTag XhTimePickerTagLabel XhTimePickerTagList XhTimePickerTrigger
组合式函数useTimePicker
状态机timePickerMachine
皮肤@xihan-ui/styles/time-picker.css

Props ​

属性类型必填说明
labelledboolean作者渲染了 label 部件时置真,由适配器统计而不是判断标题文字是否有值。 为假时可聚焦部件不把 label 的 id 写进 aria-labelledby:指向未渲染的 id 是无效引用,作者写在控件上的 aria-label 也会被它压住。
ariaLabelstring不显示出来的名字,写成 aria-label 落在与字段标签同一个部件上。 放进字段(字段接线)或渲染了 label 部件时名字以它们为准,aria-labelledby 盖过它。
valuestring | string[]受控值,ISO 时间串数组。提供即受控:cell 直读 prop,写入只发 onValueChange 不落内部值。 单选可写裸串,内部一律归一为数组(空串即空数组)。
defaultValuestring | string[]
selectionModeTimePickerSelectionMode选择模式,默认 single。
maxSelectednumbermultiple 下最多选几个时刻:选满后「添加」不可按、快捷选项只能点掉已选的。非整数向下取整,小于 1 或不是有限数时不设上限。
maxTagCountnumber多选时输入行最多摆几枚标签,其余折进 +N 那一枚;默认 3。
openboolean展开态。提供即受控:内部不再自行修改,只发 onOpenChange。
defaultOpenboolean
minstring下界(含)。裁掉浮层中落在界外的可选值,并把已填的越界值标注出来(不改写它)。
maxstring上界(含)。同上。
localestringBCP 47 语言标记。决定上午 / 下午的文字,以及未显式提供 hourCycle 时的小时制。
hourCycleTimeHourCycle小时制。未提供时按 locale 推断,locale 也没有时使用 24。
granularityTimeGranularity值精确到哪一段,默认 minute。它同时决定分段输入显示几段、浮层中排几列。
timeStepTimeStep按单位的步进:{ hour?, minute?, second? },各单位缺省 1。时的步进按 24 小时制的真实小时取。 只影响浮层中的可选值,不限制段位上手动输入的数。
presetsTimePickerPreset[]快捷选项(「当前时刻」「上午 9 点」等)。提供后浮层中多出一列,点击即整份写入值并收起。 时刻需计算后传入:连接层每帧求值,把当前时刻放进渲染期会每帧得出一个新结果。 无法解析或落在 min / max 之外的选项自动不可按下;带秒的时刻按 granularity 归一后再比较与写入。
disabledboolean禁用:分段输入整组退出 Tab 序列、触发器使用原生 disabled,隐藏输入不参与提交。
readOnlyboolean只读:浮层照常展开、列表照常浏览,但值不可修改也不可清空。
invalidboolean校验失败标注。
requiredboolean必填标注(写入每段的 aria-required)。
namestring表单字段名;提供后隐藏输入才带 name,值随表单一并提交。
placeholderstring整条占位:一段都没填、焦点也不在段上时,输入行显示这句文字(「请选择开始时间」),焦点进到段上即换回段位。 多选时没有选中值,标签行显示这句文字。
variantControlVariant形态:outline / subtle / ghost,决定输入行的描边与底色使用方式。默认 outline。
toneTone语气:brand / neutral / success / warning / danger / info,决定聚焦与选中强调使用哪族颜色。
sizeSize尺寸:sm / md / lg,输入行与浮层中的格子一并换档。
placementPlacement
dirDirection文字方向,默认 ltr。只改写浮层在行内轴上 start 与 end 的落点。
offsetnumber
isTimeUnavailableTimeUnavailablePredicate逐值可选性。value 是两位补零的格值,时列恒按 24 小时制给出(12 小时制下也换算成真实的时); unit 区分同一个 '30' 属于哪一列;context 带这份值里已选的时(24 小时制)与分, 写得出「9 点只能选 30 分以后」。date 与 index 在本组件恒为 null。 与 min / max 裁掉的值同等处理:判定为真的格子仍可聚焦,只是不可选中。 连续区间用 min / max 表达即可,该项留给每隔 15 分钟才可预约这类离散规则。
translationsPartial<TimePickerTranslations>段位读屏名的覆盖;未提供时取英文语言包里的语义名。
onValueChange(details: TimePickerValueChangeDetails) => voidvalue 变化意图回调;受控时是唯一出口,非受控时随内部写入一并通知。
onClear() => void用户按清空钮(clear-trigger)清掉了值;先发值变化,再发它。程序化的 clear() 不发。
onOpenChange(details: TimePickerOpenChangeDetails) => voidopen 变化意图回调;受控时是唯一出口,非受控时随内部转移一并通知。

TimePickerPreset ​

presets 的元素。

字段类型必填说明
valuestring是
labelstring是显示文案,同时是该项的可及名。
disabledboolean禁用该项:方向键仍可停留,但按下不写值。

事件 ​

自定义元素将载荷放在 detail;Vue 使用同名 emit。

事件载荷说明
value-changeTimePickerValueChangeDetails选中的时刻变化;detail 为 { value: string[] },单选至多一项
clear``用户按清空钮(clear-trigger)清掉了值;先发值变化,再发它。程序化的 clear() 不发。
open-changeTimePickerOpenChangeDetailsopen 状态变化;detail 为 { open: boolean }

插槽 ​

仅列出带载荷的插槽。

Vue 组件插槽载荷说明
XhTimePickerColumndefaultTimePickerColumnSlotProps
XhTimePickerPresetdefault—条目内容;未写时使用数据中的 label。
XhTimePickerPresetGroupdefaultTimePickerPresetsSlotProps自行铺设条目;未写时按 presets 数据自动铺设,两者产出的 DOM 一致。
XhTimePickerRootdefaultTimePickerRootSlotProps
XhTimePickerRootlabel—不写默认插槽时标题的内容,盖过 label 文字。

React 适配器 props ​

只列各组件自己声明的那些:继承自 ComponentPropsWithRef 的 DOM 属性不在其中,根组件上与上面 Props 表同名的也不重复列。Vue 的对应物是上面的插槽表。

React 组件属性类型必填说明
XhTimePickerColumnunitTimePickerColumnUnit是
XhTimePickerColumnchildrenSlotChildren<TimePickerColumnSlotProps>
XhTimePickerItemvaluestring是两位补零的显示串('09' / '30');上下午列写 '00' / '01'。
XhTimePickerPositionercontainer() => Element | null浮层挂载的容器;未提供时按全局配置,再未提供时挂载到 body。
XhTimePickerPresetvaluestring是该条目的身份,与 presets 数据中的 value 逐字对应。
XhTimePickerPresetGroupchildrenSlotChildren<TimePickerPresetsSlotProps>自行铺设条目;未写时按 presets 数据自动铺设,两者产出的 DOM 一致。
XhTimePickerRootlabelReactNode标题。不给 children 时铺 label 部件。
XhTimePickerRootchildrenSlotChildren<TimePickerRootSlotProps>不给时照标准结构铺整套部件。
XhTimePickerSegmentsegmentTimeSegmentType是段的身份由作者声明。
XhTimePickerTagvaluestring是它代表哪个选中值。

状态 ​

公开状态写入 data-state。

部件取值
root'open' | 'closed'
control'open' | 'closed'
trigger'open' | 'closed'
positioner'open' | 'closed'
content'open' | 'closed'
preset'checked' | 'unchecked'
column'open' | 'closed'
item'checked' | 'unchecked'

以下名称仅用于内部状态机。

状态:open · closed

事件:OPEN · TOGGLE · CLOSE · CONTROLLED.OPEN · CONTROLLED.CLOSE · VALUE.SET · VALUE.ADD · VALUE.REMOVE · VALUE.TOGGLE · TAG_LIST.TRACKED · VALUE.CLEAR · SEGMENT.STEP · SEGMENT.DIGIT · SEGMENT.CLEAR · SEGMENT.PERIOD · SEGMENT.FOCUS · SEGMENT.BLUR · OPTION.FOCUS · ITEM.SELECT · FORM.RESET · PRESS.START · PRESS.END

判据:isOpenControlled · canEdit · closesOnPreset · canPress

connect API ​

getXxxProps() 返回对应部件的宿主属性。

成员类型说明
openboolean
valuestring[]选中的时刻,ISO 时间串数组;单选至多一项,任一必填段为空时为空数组。
selectionModeTimePickerSelectionMode
draftValuestring多选时浮层里拼着的草稿(填全了才有,否则空串);单选时就是当前值。
emptyboolean没有选中值(单选时还没填全也算)。
outOfRangeboolean已填全但落在 min / max 之外。只是标注,不改写值。
disabledboolean
readOnlyboolean
invalidboolean
hourCycleTimeHourCycle实际生效的小时制(prop 未提供时由 locale 推断的值)。
granularityTimeGranularity
timeStepResolvedTimeStep实际生效的按单位步进。
segmentsTimeSegmentType[]当前参与显示的段,文档序。未列入的段由 connect 写上 hidden 收起。
focusedSegmentTimeSegmentType | null焦点所在段;焦点在分段输入外时为 null。
columnsTimePickerColumn[]当前应排列的列及每列的可选值(已按 timeStep 取样、按 min / max 裁剪)。作者据此渲染浮层。
focusedColumnTimePickerColumnUnit | null
focusedItemstring | null
presetsreadonly TimePickerPresetState[]快捷选项逐条的状态,数据顺序。未提供 presets 时为空数组。
canClearboolean清空按钮当前是否可按。
canAddboolean多选时「添加」此刻可按:草稿填全、在 min / max 之内、还没选过、也没到 maxSelected。
tagsTimePickerTagMeta[]多选时可见的标签(受 maxTagCount 截断),与 value 同序;单选恒为空数组。
overflowCountnumber被 maxTagCount 折叠的标签数。
overflowTextstring+N 标签显示的文字(由 translations.overflowTag 计算);没有折叠的标签时为空串。
translationsTimePickerTranslations解析后的文案:作者给的 translations 盖在当前语言包上。
getSegmentText(props: TimePickerSegmentProps) => string某一段应显示的文字(空段是占位串)。各适配器都用它填充文本,保证同构。
getItemText(props: TimePickerItemProps) => string某一格应显示的文字。数字列即格子自身的值,上下午列按 locale 给出「上午 / 下午」。 各适配器都用它填充文本,保证同构。
isItemSelected(props: TimePickerItemProps) => boolean
isItemDisabled(props: TimePickerItemProps) => boolean落在 min / max 之外(或整个控件禁用):仍在列表中,但不可选、方向键跳过。
setOpen(next: boolean) => void
setValue(next: string[]) => void
clear() => void
add() => void多选:把草稿收进值(与按「添加」同一条路)。
deselect(value: string) => void多选:摘掉一个选中值。
getRootProps() => T['element']
getLabelProps() => T['label']
getControlProps() => T['element']
getTagListProps() => T['element']标签行:多选时放在盒里,收纳可见标签与 +N 标签;没有选中时整体留空。单选时整体 hidden。
getTagProps(props: TimePickerTagProps) => T['element']标签:一个选中值一个,即库内 tag 的 root(data-scope="tag"),另带 data-value。
getTagLabelProps() => T['element']标签文字所在的块(tag 的 label);标签与 +N 共用。
getOverflowTagProps() => T['element']被折叠的标签合成的一个:同样是 tag 的 root,显示 overflowText、带 data-count;没有折叠的标签时 hidden。
getItemDeleteTriggerProps(props: TimePickerTagProps) => T['button']标签删除按钮:即所在标签那份 tag 的 close-trigger,可及名使用 translations.deleteItem;不占 Tab 位、按下不夺焦。
getSegmentGroupProps() => T['element']段位与分隔符的外壳:占满盒内剩余宽度,把尾部按钮推到框内末端;多选时整体 hidden。
getSegmentProps(props: TimePickerSegmentProps) => T['element']分段输入:一段一个节点,与 TimeField 的段同构(role=spinbutton + roving tabindex)。
getTriggerProps() => T['button']
getClearTriggerProps() => T['button']
getPositionerProps() => T['element']
getContentProps() => T['element']
getPresetGroupProps() => T['element']快捷选项列(role=listbox);未提供 presets 时带 hidden。
getPresetProps(props: TimePickerPresetProps) => T['element']一条快捷选项(role=option):点击把整份时间写入值并收起浮层。
getColumnProps(props: TimePickerColumnProps) => T['element']
getItemProps(props: TimePickerItemProps) => T['element']
getFooterProps() => T['element']浮层底部的操作区:放在 content 中、排在各列之后,「添加」钮通常写在这里;不进入任何集合的拥有关系,方向键也无法到达。
getConfirmTriggerProps() => T['button']「添加」:多选时把浮层里拼好的草稿收进值,浮层不收起;单选时 hidden。文字由作者写。
getHiddenInputProps(props?: TimePickerHiddenInputProps) => T['input']表单出口:一份 type=hidden 的原生输入,随表单提交 ISO 串。 多选时一个选中值一份同名输入:传 { value } 产出那一份,不传是首个选中值那一份。

无障碍 ​

键盘 ​

规格出处:W3C APG

按键生效条件行为
Backspacefocus in trigger, multiple, 有选中值, not disabled/readOnly摘掉最后一个选中值(标签行末尾那一枚);多选时段位不出现,触发钮就是键盘入口
ArrowDown / ArrowUpfocus in trigger, closed, not disabled展开浮层,焦点落到时列(已选的时仍可选就停在它上面,否则停在首格)
Enter / Spacefocus in trigger, not disabled按钮的默认激活即展开/收起(不额外拦键,否则会一开一关)
ArrowDownopen, focus in 某一列列内下移一格,到尾回绕;被 min/max 裁掉的格自动跳过
ArrowUpopen, focus in 某一列列内上移一格,到头回绕;被 min/max 裁掉的格自动跳过
Homeopen, focus in 某一列焦点移到本列首格
Endopen, focus in 某一列焦点移到本列末格
ArrowRightopen换到下一列并落在该列的锚点上;已在末列则不动,不回绕
ArrowLeftopen换到上一列并落在该列的锚点上;已在首列则不动,不回绕
Enter / Spaceopen, 焦点停在可选的格上, not disabled/readOnly把这一格写进对应的段;浮层不收起(其余列还要接着挑)
ArrowUp / ArrowDown / Home / Endopen, focus in 快捷选项列在快捷选项之间移动焦点,到头回绕;时分秒那几列的处理器在这一列内不参与
Enter / Spaceopen, focus in 某条快捷选项, not disabled/readOnly把这条快捷选项整份写进值并收起浮层
Escapeopen收起浮层并把焦点归还触发器,值不变
Tab / Shift+Tabopen不拦按键:焦点按 Tab 序列在各列、快捷选项列与底栏之间走,浮层不收;走出浮层后随即收起且不抢回焦点
ArrowUpfocus in 某一段, not disabled/readOnly本段加一格,到头回绕;空段落到该段下界
ArrowDownfocus in 某一段, not disabled/readOnly本段减一格,到头回绕;空段落到该段上界
ArrowRightfocus in 某一段, not disabled焦点移到下一段;已在末段则不动,不回绕
ArrowLeftfocus in 某一段, not disabled焦点移到上一段;已在首段则不动,不回绕
Homefocus in 某一段, not disabled焦点移到首段
Endfocus in 某一段, not disabled焦点移到末段
0-9focus in 数字段, not disabled/readOnly把数字并进本段;本段再吃不下第二位时自动跳到下一段
Backspace / Deletefocus in 某一段, not disabled/readOnly清掉本段;小时被清时上下午段仍保留原来的上午/下午
a / pfocus in 上下午段, 12 小时制, not disabled/readOnlya 取上午、p 取下午(不区分大小写)
Alt+ArrowDownfocus in 某一段, closed, not disabled展开浮层并把焦点移入;触发按钮是可选部件,键盘入口不能只挂在它上面
Enterfocus in 某一段, open收起浮层。段位里敲出来的值不触发「选完即收」(那时人还在打字),这是那条路的收口手势
Enter / Spaceheld on trigger(not disabled)、clear-trigger(可清)、preset 或 item(open, not disabled/readOnly, 该条可按)按住期间该部件投影 data-pressed,与指针 :active 同一副按压面;抬起或失焦撤下,浮层收起时一并撤下

ARIA ​

以下属性由 connect 生成。

部件属性值
controlaria-disabled'true' | 'false'
controlaria-invalid'true' | 'false'
controlaria-labelprops.ariaLabel
controlaria-labelledbylabel 部件的 id | undefined
controlrole'group'
segmentaria-disabled'true' | 'false'
segmentaria-invalid'true' | 'false'
segmentaria-labeltranslations[segment]
segmentaria-readonly'true' | 'false'
segmentaria-required'true' | 'false'
segmentaria-valuemaxrange.max
segmentaria-valueminrange.min
segmentaria-valuenowsegmentNumber(draft, segment, hourCycle)
segmentaria-valuetexttimeSegmentText(draft, segment, { hourCycle, locale })
segmentrole'spinbutton'
triggeraria-controlscontent 部件的 id
triggeraria-expanded'true' | 'false'
triggeraria-haspopup'dialog'
triggeraria-labelprops.ariaLabel
triggeraria-labelledbylabel 部件的 id | undefined
clear-triggeraria-labeltranslations.clearTrigger
contentaria-hidden!open || undefined
contentaria-labelprops.ariaLabel
contentaria-labelledbylabel 部件的 id | undefined
contentaria-modal'false'
contentrole'dialog'
preset-grouparia-disabled'true' | 'false'
preset-grouparia-labeltranslations.presets
preset-grouparia-multiselectable'false'
preset-grouparia-orientation'vertical'
preset-grouprole'listbox'
presetaria-disabled'true' | 'false'
presetaria-selected'true' | 'false'
presetrole'option'
columnaria-disabled'true' | 'false'
columnaria-labeltranslations[unit]
columnaria-multiselectable'false'
columnaria-orientation'vertical'
columnrole'listbox'
itemaria-disabled'true' | 'false'
itemaria-selected'true' | 'false'
itemrole'option'

样式参考 ​

皮肤 ​

@xihan-ui/styles/time-picker.css 按 [data-scope="time-picker"][data-part="root"] 部件选择器书写,发布产物以挂载类 .xh-scope-time-picker 代替其中的 data-scope(特异性相同),位于 xihan.components 与 xihan.motion 层。覆盖样式使用 xihan.overrides,部件选择器照常可用。

forced-colors: active 下另有一套规则:颜色交给系统,边框与状态标记改用系统色关键字。

数据属性 ​

由 connect 生成;条件不成立时不输出无值属性。

部件属性值
rootdata-disabled''(条件成立时才出现)
rootdata-empty''(条件成立时才出现)
rootdata-invalid''(条件成立时才出现)
rootdata-out-of-range''(条件成立时才出现)
rootdata-readonly''(条件成立时才出现)
rootdata-sizeprops.size
rootdata-state'open' | 'closed'
rootdata-toneprops.tone
rootdata-variantprops.variant
labeldata-disabled''(条件成立时才出现)
controldata-disabled''(条件成立时才出现)
controldata-empty''(条件成立时才出现)
controldata-invalid''(条件成立时才出现)
controldata-readonly''(条件成立时才出现)
controldata-state'open' | 'closed'
controldata-variantprops.variant
controldata-xh-action-owner''
controldata-xh-field-chrome''
controldata-xh-field-layout'multi-tag' | undefined
controldata-xh-field-sizeprops.size
tag-listdata-disabled''(条件成立时才出现)
tag-listdata-instant''(条件成立时才出现)
tag-listdata-placeholder-shown''(条件成立时才出现)
tag-listdata-placeholder-textprops.placeholder | undefined | undefined
tag-listdata-xh-tag-list''
segment-groupdata-disabled''(条件成立时才出现)
segment-groupdata-invalid''(条件成立时才出现)
segment-groupdata-placeholder-shown''(条件成立时才出现)
segment-groupdata-placeholder-textprops.placeholder | undefined
segment-groupdata-readonly''(条件成立时才出现)
segmentdata-disabled''(条件成立时才出现)
segmentdata-focus''(条件成立时才出现)
segmentdata-invalid''(条件成立时才出现)
segmentdata-placeholder''(条件成立时才出现)
segmentdata-readonly''(条件成立时才出现)
triggerdata-disabled''(条件成立时才出现)
triggerdata-pressed''(条件成立时才出现)
triggerdata-state'open' | 'closed'
triggerdata-xh-action-control''
triggerdata-xh-action-display'always'
triggerdata-xh-action-profile'field-inset'
triggerdata-xh-action-sizeprops.size
triggerdata-xh-action-variant'ghost'
clear-triggerdata-pressed''(条件成立时才出现)
clear-triggerdata-xh-action-control''
clear-triggerdata-xh-action-display'has-value'
clear-triggerdata-xh-action-has-value''(条件成立时才出现)
clear-triggerdata-xh-action-profile'field-inset'
clear-triggerdata-xh-action-sizeprops.size
clear-triggerdata-xh-action-variant'ghost'
positionerdata-hidden''(条件成立时才出现)
positionerdata-placement定位引擎算出的实际落位
positionerdata-positioned''(条件成立时才出现)
positionerdata-sizeprops.size
positionerdata-state'open' | 'closed'
positionerdata-toneprops.tone
positionerdata-variantprops.variant
contentdata-instant''(条件成立时才出现)
contentdata-placement定位引擎算出的实际落位
contentdata-state'open' | 'closed'
presetdata-disabled''(条件成立时才出现)
presetdata-pressed''(条件成立时才出现)
presetdata-state'checked' | 'unchecked'
presetdata-xh-collection-context'overlay'
presetdata-xh-collection-item''
presetdata-xh-collection-sizeprops.size
columndata-disabled''(条件成立时才出现)
columndata-state'open' | 'closed'
itemdata-disabled''(条件成立时才出现)
itemdata-highlighted''(条件成立时才出现)
itemdata-pressed''(条件成立时才出现)
itemdata-state'checked' | 'unchecked'
itemdata-xh-collection-context'overlay'
itemdata-xh-collection-item''
itemdata-xh-collection-sizeprops.size
confirm-triggerdata-disabled''(条件成立时才出现)
confirm-triggerdata-pressed''(条件成立时才出现)
confirm-triggerdata-xh-action-control''
confirm-triggerdata-xh-action-display'always'
confirm-triggerdata-xh-action-profile'text'
confirm-triggerdata-xh-action-size'xs'
confirm-triggerdata-xh-action-variant'solid'
confirm-triggerdata-xh-ink-surface''
overflow-tagdata-countString(overflowCount)
tagdata-valuev

CSS 变量 ​

本组件公开覆盖槽由独立皮肤的实际消费位生成;默认来源、作用部件和状态均与 CSS 同源。

变量部件CSS 属性状态默认来源说明
--xh-time-picker-action-bgclear-trigger
trigger
--xh-ink-surface
background-color
default
xh-ink-surface
--xh-_action-variant-bg-resttime-picker 的 clear-trigger、trigger 部件 --xh-ink-surface、background-color 覆盖槽。
--xh-time-picker-action-bg-activeclear-trigger
trigger
background-colordisabled
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-_action-variant-bg-pressedtime-picker 的 clear-trigger、trigger 部件 background-color 覆盖槽。
--xh-time-picker-action-bg-hoverclear-trigger
trigger
--xh-ink-surface
background-color
disabled
hover
loading
not([data-disabled])
not([data-loading])
state=open
xh-ink-surface
--xh-_action-variant-bg-hovertime-picker 的 clear-trigger、trigger 部件 --xh-ink-surface、background-color 覆盖槽。
--xh-time-picker-action-fgclear-trigger
trigger
colordefault--xh-fg-field-clear
--xh-fg-muted
time-picker 的 clear-trigger、trigger 部件 color 覆盖槽。
--xh-time-picker-action-fg-hoverclear-trigger
trigger
colordisabled
hover
loading
not([data-disabled])
not([data-loading])
state=open
--xh-fg-defaulttime-picker 的 clear-trigger、trigger 部件 color 覆盖槽。
--xh-time-picker-action-font-sizeclear-trigger
trigger
font-sizedefault--xh-text-secondary-sizetime-picker 的 clear-trigger、trigger 部件 font-size 覆盖槽。
--xh-time-picker-action-radiusclear-trigger
trigger
border-radiusdefault--xh-shape-circle
--xh-shape-inset
time-picker 的 clear-trigger、trigger 部件 border-radius 覆盖槽。
--xh-time-picker-action-sizeclear-trigger
trigger
block-size
inline-size
min-inline-size
default
xh-action-profile=field-inset
--xh-_action-profile-visual-sizetime-picker 的 clear-trigger、trigger 部件 block-size、inline-size、min-inline-size 覆盖槽。
--xh-time-picker-column-dividercolumn
preset-group
border-inline-end
border-inline-start
default--xh-material-solid-bordertime-picker 的 column、preset-group 部件 border-inline-end、border-inline-start 覆盖槽。
--xh-time-picker-column-gapcolumn
item
gap
inset-block
default--xh-space-2time-picker 的 column、item 部件 gap、inset-block 覆盖槽。
--xh-time-picker-column-hcolumnblock-size
padding-block
default--xh-overlay-time-column-htime-picker 的 column 部件 block-size、padding-block 覆盖槽。
--xh-time-picker-column-min-wcolumnmin-inline-sizedefault--xh-overlay-time-column-wtime-picker 的 column 部件 min-inline-size 覆盖槽。
--xh-time-picker-column-pxcolumnpadding-inlinedefault--xh-space-1time-picker 的 column 部件 padding-inline 覆盖槽。
--xh-time-picker-column-pycolumnpadding-blockdefault--xh-space-1time-picker 的 column 部件 padding-block 覆盖槽。
--xh-time-picker-confirm-trigger-bgconfirm-trigger--xh-ink-surface
background-color
default
xh-ink-surface
--xh-_action-variant-bg-resttime-picker 的 confirm-trigger 部件 --xh-ink-surface、background-color 覆盖槽。
--xh-time-picker-confirm-trigger-bg-activeconfirm-triggerbackground-colordisabled
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-_action-variant-bg-pressedtime-picker 的 confirm-trigger 部件 background-color 覆盖槽。
--xh-time-picker-confirm-trigger-bg-hoverconfirm-triggerbackground-colordisabled
hover
loading
not([data-disabled])
not([data-loading])
--xh-_action-variant-bg-hovertime-picker 的 confirm-trigger 部件 background-color 覆盖槽。
--xh-time-picker-confirm-trigger-fgconfirm-triggercolordefault
disabled
hover
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-_action-variant-fg-hover
--xh-_action-variant-fg-pressed
--xh-_action-variant-fg-rest
time-picker 的 confirm-trigger 部件 color 覆盖槽。
--xh-time-picker-confirm-trigger-font-sizeconfirm-triggerfont-sizedefault--xh-text-caption-sizetime-picker 的 confirm-trigger 部件 font-size 覆盖槽。
--xh-time-picker-confirm-trigger-hconfirm-triggerblock-size
inline-size
default
xh-action-profile=field-inset
--xh-_action-profile-visual-sizetime-picker 的 confirm-trigger 部件 block-size、inline-size 覆盖槽。
--xh-time-picker-confirm-trigger-marginconfirm-trigger
content
margindefault--xh-space-2time-picker 的 confirm-trigger、content 部件 margin 覆盖槽。
--xh-time-picker-confirm-trigger-pxconfirm-triggerpadding-inlinedefault--xh-space-2time-picker 的 confirm-trigger 部件 padding-inline 覆盖槽。
--xh-time-picker-confirm-trigger-radiusconfirm-triggerborder-radiusdefault--xh-shape-controltime-picker 的 confirm-trigger 部件 border-radius 覆盖槽。
--xh-time-picker-confirm-trigger-shadowconfirm-triggerbox-shadowdefault
disabled
hover
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
nonetime-picker 的 confirm-trigger 部件 box-shadow 覆盖槽。
--xh-time-picker-content-bgcontentbackgrounddefault--xh-bg-surfacetime-picker 的 content 部件 background 覆盖槽。
--xh-time-picker-content-bordercontentborderdefault--xh-border-defaulttime-picker 的 content 部件 border 覆盖槽。
--xh-time-picker-content-fgcontentcolordefault--xh-fg-defaulttime-picker 的 content 部件 color 覆盖槽。
--xh-time-picker-content-max-hcontentmax-block-sizedefaultnonetime-picker 的 content 部件 max-block-size 覆盖槽。
--xh-time-picker-content-pxcontentpadding-inlinedefault--xh-space-0time-picker 的 content 部件 padding-inline 覆盖槽。
--xh-time-picker-content-pycontentpadding-blockdefault--xh-space-0time-picker 的 content 部件 padding-block 覆盖槽。
--xh-time-picker-content-radiuscontentborder-radiusdefault--xh-shape-overlaytime-picker 的 content 部件 border-radius 覆盖槽。
--xh-time-picker-content-shadowcontentbox-shadowdefault--xh-elevation-floatingtime-picker 的 content 部件 box-shadow 覆盖槽。
--xh-time-picker-control-bgcontrolbackground-colorxh-field-chrome--xh-_field-variant-bg-resttime-picker 的 control 部件 background-color 覆盖槽。
--xh-time-picker-control-bg-disabledcontrolbackground-colordisabled
xh-field-chrome
--xh-_field-variant-bg-disabledtime-picker 的 control 部件 background-color 覆盖槽。
--xh-time-picker-control-bg-hovercontrolbackground-colordisabled
hover
invalid
loading
not(:focus-within)
not([data-disabled])
not([data-invalid])
not([data-loading])
not([data-readonly])
readonly
xh-field-chrome
--xh-_field-variant-bg-hovertime-picker 的 control 部件 background-color 覆盖槽。
--xh-time-picker-control-bg-readonlycontrolbackground-colorreadonly
xh-field-chrome
--xh-_field-variant-bg-read-onlytime-picker 的 control 部件 background-color 覆盖槽。
--xh-time-picker-control-bordercontrolborderxh-field-chrome--xh-_field-variant-border-resttime-picker 的 control 部件 border 覆盖槽。
--xh-time-picker-control-border-focuscontrolborder-color
box-shadow
disabled
focus-within
not([data-disabled])
xh-field-chrome
--xh-_field-variant-border-focustime-picker 的 control 部件 border-color、box-shadow 覆盖槽。
--xh-time-picker-control-border-hovercontrolborder-colordisabled
hover
invalid
loading
not(:focus-within)
not([data-disabled])
not([data-invalid])
not([data-loading])
not([data-readonly])
readonly
xh-field-chrome
--xh-_field-variant-border-hovertime-picker 的 control 部件 border-color 覆盖槽。
--xh-time-picker-control-border-invalidcontrolborder-colorinvalid
xh-field-chrome
--xh-_field-variant-border-invalidtime-picker 的 control 部件 border-color 覆盖槽。
--xh-time-picker-control-fgcontrolcolorxh-field-chrome--xh-fg-defaulttime-picker 的 control 部件 color 覆盖槽。
--xh-time-picker-control-gapcontrolgapxh-field-chrome--xh-_time-picker-gaptime-picker 的 control 部件 gap 覆盖槽。
--xh-time-picker-control-hcontrolblock-size
min-block-size
has([data-xh-field-input][data-xh-field-layout='multi-tag'])
has([data-xh-field-input][data-xh-field-layout='single-line'])
has([data-xh-field-input][data-xh-field-layout='textarea'])
xh-field-chrome
xh-field-input
xh-field-layout=multi-tag
xh-field-layout=single-line
xh-field-layout=textarea
--xh-_time-picker-control-htime-picker 的 control 部件 block-size、min-block-size 覆盖槽。
--xh-time-picker-control-max-hcontrolmax-block-sizexh-field-layout=multi-tag--xh-viewport-h-smtime-picker 的 control 部件 max-block-size 覆盖槽。
--xh-time-picker-control-min-wcontrol
root
min-inline-sizedefault
xh-field-chrome
--xh-control-min-wtime-picker 的 control、root 部件 min-inline-size 覆盖槽。
--xh-time-picker-control-pxcontrolpadding-inlinexh-field-chrome--xh-_time-picker-control-pxtime-picker 的 control 部件 padding-inline 覆盖槽。
--xh-time-picker-control-radiuscontrolborder-radiusxh-field-chrome--xh-shape-controltime-picker 的 control 部件 border-radius 覆盖槽。
--xh-time-picker-control-shadowcontrolbox-shadowxh-field-chromenonetime-picker 的 control 部件 box-shadow 覆盖槽。
--xh-time-picker-control-wrootinline-size
min-inline-size
default--xh-control-wtime-picker 的 root 部件 inline-size、min-inline-size 覆盖槽。
--xh-time-picker-font-sizecontrolfont-sizedefault--xh-_time-picker-font-sizetime-picker 的 control 部件 font-size 覆盖槽。
--xh-time-picker-footer-borderfooterborder-block-startdefault--xh-material-solid-bordertime-picker 的 footer 部件 border-block-start 覆盖槽。
--xh-time-picker-footer-fgfootercolordefault--xh-fg-mutedtime-picker 的 footer 部件 color 覆盖槽。
--xh-time-picker-footer-font-sizefooterfont-sizedefault--xh-text-caption-sizetime-picker 的 footer 部件 font-size 覆盖槽。
--xh-time-picker-footer-gapfootergap
inline-size
default--xh-space-2time-picker 的 footer 部件 gap、inline-size 覆盖槽。
--xh-time-picker-footer-pxfooterinline-sizedefault--xh-space-2time-picker 的 footer 部件 inline-size 覆盖槽。
--xh-time-picker-footer-pyfooterpadding-blockdefault--xh-space-2time-picker 的 footer 部件 padding-block 覆盖槽。
--xh-time-picker-gaplabel
root
gap
margin-block-end
default--xh-space-1time-picker 的 label、root 部件 gap、margin-block-end 覆盖槽。
--xh-time-picker-icon-sizecontrol
positioner
root
--xh-icon-sizedefault
is([data-part='root'], [data-part='positioner'])
size=lg
size=sm
xh-field-chrome
--xh-_field-size-glyph-size
--xh-glyph-size-lg
--xh-glyph-size-md
--xh-glyph-size-sm
time-picker 的 control、positioner、root 部件 --xh-icon-size 覆盖槽。
--xh-time-picker-item-bg-hoveritembackground-colordisabled
error
highlighted
hover
is(:focus-visible, [data-highlighted])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
selected
xh-collection-context=overlay
--xh-bg-subtletime-picker 的 item 部件 background-color 覆盖槽。
--xh-time-picker-item-bg-presseditembackground-colordisabled
error
is(:active, [data-pressed])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
selected
xh-collection-context=overlay
--xh-bg-subtle-hovertime-picker 的 item 部件 background-color 覆盖槽。
--xh-time-picker-item-check-fgitembackground-colordefault--xh-_time-picker-check-fgtime-picker 的 item 部件 background-color 覆盖槽。
--xh-time-picker-item-check-sizeitemblock-size
inline-size
padding-inline
default--xh-control-indicator-sizetime-picker 的 item 部件 block-size、inline-size、padding-inline 覆盖槽。
--xh-time-picker-item-fgitemcolordefault
disabled
error
highlighted
hover
is(:active, [data-pressed])
is(:focus-visible, [data-highlighted])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
selected
xh-collection-context=overlay
--xh-material-frosted-fgtime-picker 的 item 部件 color 覆盖槽。
--xh-time-picker-item-fg-selecteditemcolordisabled
error
highlighted
hover
is(:active, [data-pressed])
is(:focus-visible, [data-highlighted])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
selected
xh-collection-context=overlay
--xh-time-picker-item-fgtime-picker 的 item 部件 color 覆盖槽。
--xh-time-picker-item-font-sizeitemfont-sizedefault--xh-_time-picker-font-sizetime-picker 的 item 部件 font-size 覆盖槽。
--xh-time-picker-item-font-weight-selecteditemfont-weightdisabled
error
highlighted
hover
is(:active, [data-pressed])
is(:focus-visible, [data-highlighted])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
selected
xh-collection-context=overlay
--xh-font-weight-mediumtime-picker 的 item 部件 font-weight 覆盖槽。
--xh-time-picker-item-hcolumn
item
block-size
padding-block
default--xh-control-action-sizetime-picker 的 column、item 部件 block-size、padding-block 覆盖槽。
--xh-time-picker-item-pxitempadding-inlinedefault--xh-space-0_5time-picker 的 item 部件 padding-inline 覆盖槽。
--xh-time-picker-item-radiusitemborder-radiusdefault--xh-shape-insettime-picker 的 item 部件 border-radius 覆盖槽。
--xh-time-picker-label-fglabelcolordefault--xh-fg-mutedtime-picker 的 label 部件 color 覆盖槽。
--xh-time-picker-label-fg-disabledlabelcolordisabled--xh-fg-mutedtime-picker 的 label 部件 color 覆盖槽。
--xh-time-picker-label-font-sizelabelfont-sizedefault--xh-text-label-sizetime-picker 的 label 部件 font-size 覆盖槽。
--xh-time-picker-label-font-weightlabelfont-weightdefault--xh-text-label-weighttime-picker 的 label 部件 font-weight 覆盖槽。
--xh-time-picker-label-gaplabelmargin-block-enddefault--xh-space-2time-picker 的 label 部件 margin-block-end 覆盖槽。
--xh-time-picker-layerpositionerz-indexdefault--xh-_layertime-picker 的 positioner 部件 z-index 覆盖槽。
--xh-time-picker-literal-fgsegment-groupcolornot([data-scope])--xh-fg-subtletime-picker 的 segment-group 部件 color 覆盖槽。
--xh-time-picker-placeholder-fgsegment
segment-group
tag-list
colorplaceholder
placeholder-shown
--xh-fg-subtletime-picker 的 segment、segment-group、tag-list 部件 color 覆盖槽。
--xh-time-picker-preset-bgpresetbackground-colordefault
disabled
error
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
selected
xh-collection-context=overlay
--xh-bg-subtletime-picker 的 preset 部件 background-color 覆盖槽。
--xh-time-picker-preset-bg-hoverpresetbackground-colordisabled
error
highlighted
hover
is(:focus-visible, [data-highlighted])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
selected
xh-collection-context=overlay
--xh-bg-subtle-hovertime-picker 的 preset 部件 background-color 覆盖槽。
--xh-time-picker-preset-bg-pressedpresetbackground-colordisabled
error
is(:active, [data-pressed])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
selected
xh-collection-context=overlay
--xh-bg-subtle-activetime-picker 的 preset 部件 background-color 覆盖槽。
--xh-time-picker-preset-check-fgpresetbackground-colordefault--xh-_time-picker-check-fgtime-picker 的 preset 部件 background-color 覆盖槽。
--xh-time-picker-preset-check-sizepresetblock-size
inline-size
padding-inline-end
default--xh-control-indicator-smtime-picker 的 preset 部件 block-size、inline-size、padding-inline-end 覆盖槽。
--xh-time-picker-preset-fgpresetcolordefault
disabled
error
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
selected
xh-collection-context=overlay
--xh-fg-mutedtime-picker 的 preset 部件 color 覆盖槽。
--xh-time-picker-preset-fg-disabledpresetbackground-color
color
default
disabled
--xh-fg-disabledtime-picker 的 preset 部件 background-color、color 覆盖槽。
--xh-time-picker-preset-fg-hoverpresetcolordisabled
error
highlighted
hover
is(:active, [data-pressed])
is(:focus-visible, [data-highlighted])
is([aria-selected='true'], [data-selected])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
selected
xh-collection-context=overlay
--xh-fg-defaulttime-picker 的 preset 部件 color 覆盖槽。
--xh-time-picker-preset-font-sizepresetfont-sizedefault--xh-text-caption-sizetime-picker 的 preset 部件 font-size 覆盖槽。
--xh-time-picker-preset-group-gappreset-groupgapdefault--xh-space-1time-picker 的 preset-group 部件 gap 覆盖槽。
--xh-time-picker-preset-group-hpreset-groupmax-block-sizedefault--xh-overlay-time-column-htime-picker 的 preset-group 部件 max-block-size 覆盖槽。
--xh-time-picker-preset-group-pxpreset-grouppadding-inlinedefault--xh-space-2time-picker 的 preset-group 部件 padding-inline 覆盖槽。
--xh-time-picker-preset-group-pypreset-grouppadding-blockdefault--xh-space-2_5time-picker 的 preset-group 部件 padding-block 覆盖槽。
--xh-time-picker-preset-hpresetblock-size
line-height
default--xh-control-action-sizetime-picker 的 preset 部件 block-size、line-height 覆盖槽。
--xh-time-picker-preset-pxpresetinset-inline-end
padding-inline
padding-inline-end
default--xh-space-2time-picker 的 preset 部件 inset-inline-end、padding-inline、padding-inline-end 覆盖槽。
--xh-time-picker-preset-radiuspresetborder-radiusdefault--xh-shape-controltime-picker 的 preset 部件 border-radius 覆盖槽。
--xh-time-picker-segment-bg-focussegmentbackgrounddisabled
focus
focus-visible
not([data-disabled])
--xh-_time-picker-segment-bgtime-picker 的 segment 部件 background 覆盖槽。
--xh-time-picker-segment-bg-hoversegmentbackgrounddisabled
focus
hover
not([data-focus], [data-disabled])
--xh-bg-subtletime-picker 的 segment 部件 background 覆盖槽。
--xh-time-picker-segment-bg-invalid-focussegmentbackgroundfocus
invalid
is([data-focus], :focus-visible)
--xh-bg-subtletime-picker 的 segment 部件 background 覆盖槽。
--xh-time-picker-segment-fg-focussegmentcolordisabled
focus
focus-visible
not([data-disabled])
placeholder
--xh-_time-picker-segment-fgtime-picker 的 segment 部件 color 覆盖槽。
--xh-time-picker-segment-fg-invalidsegmentcolorinvalid--xh-fg-dangertime-picker 的 segment 部件 color 覆盖槽。
--xh-time-picker-segment-fg-invalid-focussegmentcolorfocus
invalid
is([data-focus], :focus-visible)
--xh-fg-dangertime-picker 的 segment 部件 color 覆盖槽。
--xh-time-picker-segment-pxsegmentpadding-inlinedefault--xh-space-0_5time-picker 的 segment 部件 padding-inline 覆盖槽。
--xh-time-picker-segment-radiussegmentborder-radiusdefault--xh-shape-insettime-picker 的 segment 部件 border-radius 覆盖槽。
--xh-time-picker-tag-list-gaptag-listgapxh-tag-list--xh-space-1time-picker 的 tag-list 部件 gap 覆盖槽。

动效 ​

动效角色:按压 · 状态 · 指示与换位 · 出现 · 列表(见动效规范)。

共享关键帧 xh-fade-in · xh-fade-out · xh-overlay-pop-in · xh-pop-in · xh-pop-out 由 family/motion.css 提供,皮肤 @import 它,单独引入仍成立;background-color · border-color · color · opacity · translate 走 transition 过渡。时长与缓动读动效令牌,改令牌即改全局节奏。

皮肤之外还有一段:退场由适配器的退场闸门把关,动画播完才真收起。

系统开启减弱动效时由令牌层统一收敛,皮肤不另作判断。

响应式 ​

皮肤另按输入能力分档:hover: hover · hover: none:同一份皮肤在触屏与带指针的设备上不一样,与视口宽度无关。

RTL ​

皮肤用逻辑属性排布(inline-start 一族),dir="rtl" 下自动镜像。

Released under The MIT License