生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

Icon ​

General component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="icon": root · glyph

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-icon>
Vue componentsXhIcon
ComposableuseIcon
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/icon.css

Props ​

PropTypeRequired
flipIconFlip
frameActionVariant
iconIconRecord
labelstring
rotateIconRotate | string
sizeIconSize
toneTone
weightIconWeight

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
labelstring | undefined
decorativeboolean
nodesreadonly IconNode[]
contentIconRecord | undefined
getRootProps() => T['element']
getGlyphProps() => T['element']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

No keyboard interaction: the component takes no focus, or focus behavior comes entirely from native elements.

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootaria-hidden'true' | undefined
rootaria-labelprops.label | undefined
rootroleundefined | 'img'

Style reference ​

Skin ​

@xihan-ui/styles/icon.css is written against [data-scope="icon"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-icon in place of data-scope (same specificity) and sits in the xihan.components layer. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-flipprops.flip
rootdata-frameprops.frame
rootdata-iconicon?.name
rootdata-rotaterotateAttr(props.rotate)
rootdata-sizeprops.size
rootdata-toneprops.tone
rootdata-weightprops.weight

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-icon-fgrootcolordefault
frame=ghost
frame=outline
frame=solid
frame=subtle
tone
--xh-_tone-fg
--xh-_tone-on
--xh-fg-default
--xh-fg-on-brand
currentColor
--xh-icon-frame-bgrootbackgroundframe=solid
frame=subtle
tone
--xh-_tone
--xh-_tone-subtle
--xh-bg-brand
--xh-bg-subtle
--xh-icon-frame-borderrootborder-colorframe=outline
tone
--xh-_tone-border
--xh-border-default
--xh-icon-frame-glyph-sizerootpaddingframe
size=lg
size=sm
--xh-_icon-glyph-step
--xh-glyph-size-lg
--xh-glyph-size-sm
--xh-icon-frame-radiusrootborder-radiusframe--xh-shape-circle
--xh-icon-frame-shadowrootbox-shadowframe=solid
tone
--xh-_highlight-brand
--xh-_highlight-tone
--xh-icon-frame-sizerootblock-size
inline-size
padding
frame
size=lg
size=sm
--xh-_icon-frame-step
--xh-control-h-lg
--xh-control-h-sm
--xh-icon-shiftrootvertical-aligndefault--xh-glyph-baseline-shift
--xh-icon-sizeautoplay-trigger
branch-error
branch-indicator
branch-loading
branch-trigger
cancel-trigger
caps-lock-indicator
clear-trigger
close-trigger
column-header
comment-trigger
condition-delete-trigger
control
decrement-trigger
dismiss-trigger
edit-trigger
ellipsis-trigger
expand-trigger
first-trigger
flip-horizontal-trigger
flip-vertical-trigger
group-delete-trigger
increment-trigger
indicator
item
item-close-trigger
item-delete-trigger
item-indicator
item-preview
last-trigger
line-content
line-fold-trigger
loading
move-down-trigger
move-up-trigger
next-trigger
next-year-trigger
overflow-trigger
path
path-item
prev-trigger
prev-year-trigger
reset-trigger
root
rotate-left-trigger
rotate-right-trigger
scroll-to-end-trigger
separator
sort-trigger
status
submit-trigger
to-source-trigger
to-target-trigger
toolbar
trend
trigger
trigger-indicator
truncation
viewport
visibility-trigger
window-state-trigger
zoom-in-trigger
zoom-out-trigger
block-size
column-gap
inline-size
@media (min-width: 640px)
default
direction
empty
error
folded
has(> [data-part='unread-count']:only-child)
is([data-part='edit-trigger'], [data-part='submit-trigger'], [data-part='cancel-trigger'])
mode=send
mode=stop
not([data-part='status'])
not([data-variant='dot'])
preset=toast
size=2xl
size=3xl
size=4xl
size=lg
size=md
size=sm
size=text
size=xl
sort=asc
sort=desc
state=completed
state=paused
state=running
state=visible
variant=dot
--xh-_color-swatch-picker-mark
--xh-glyph-size-2xl
--xh-glyph-size-3xl
--xh-glyph-size-4xl
--xh-glyph-size-lg
--xh-glyph-size-md
--xh-glyph-size-sm
--xh-glyph-size-text
--xh-glyph-size-xl
--xh-icon-strokerootstroke-widthdefault
weight=bold
weight=light
--xh-glyph-stroke-bold
--xh-glyph-stroke-light
--xh-glyph-stroke-regular

Released under The MIT License