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

查看生态总览
Skip to content

Reasoning alpha ​

AI chat 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="reasoning": root · trigger · icon · indicator · label · duration · content

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-reasoning>
Vue componentsXhReasoningContent XhReasoningDuration XhReasoningIcon XhReasoningIndicator XhReasoningLabel XhReasoningRoot XhReasoningTrigger
ComposableuseReasoning
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/reasoning.css

Props ​

PropTypeRequired
autoDisclosureboolean
defaultOpenboolean
disabledboolean
endTimenumber
onOpenChange(details: ToolCallOpenChangeDetails) => void
openboolean
sizeSize
startTimenumber
streamingboolean
toneTone
translationsPartial<ReasoningTranslations>
variantControlVariant

Events ​

Custom elements put the payload in detail; Vue emits an event of the same name.

EventPayload
open-changeToolCallOpenChangeDetails

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhReasoningRootdefaultReasoningRootSlotProps

React adapter props ​

Only the props each component declares itself: DOM attributes inherited from ComponentPropsWithRef are left out, and root props already listed in the Props table are not repeated. The Vue counterpart is the slot table above.

React componentPropTypeRequired
XhReasoningRootchildrenSlotChildren<ReasoningRootSlotProps>

State ​

Public state is written to data-state.

PartValues
root'open' | 'closed'
trigger'open' | 'closed'
indicator'open' | 'closed'
content'open' | 'closed'

connect API ​

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

MemberType
openboolean
streamingboolean
disabledboolean
durationMsnumber | undefined
elapsedMsnumber | undefined
statusTextstring
setOpen(next: boolean) => void
getRootProps() => T['element']
getTriggerProps() => T['button']
getIconProps() => T['element']
getIndicatorProps() => T['element']
getLabelProps() => T['element']
getDurationProps() => T['element']
getContentProps() => 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.

KeysBehavior
Enter / Spacereasoning.kbd.toggle
Enter / Spacereasoning.kbd.press

ARIA ​

These attributes are produced by connect.

PartAttributeValue
triggeraria-controlsid of the content part
triggeraria-expanded'true' | 'false'
iconaria-hidden'true'
indicatoraria-hidden'true'
contentaria-labelledbyid of the trigger part
contentrole'region'

Style reference ​

Skin ​

@xihan-ui/styles/reasoning.css is written against [data-scope="reasoning"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-reasoning in place of data-scope (same specificity) and sits in the xihan.components and xihan.motion layers. 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-disabled'' (present only while the condition holds)
rootdata-sizeprops.size
rootdata-state'open' | 'closed'
rootdata-streaming'' (present only while the condition holds)
rootdata-toneprops.tone
rootdata-variantprops.variant
triggerdata-disabled'' (present only while the condition holds)
triggerdata-pressed'' (present only while the condition holds)
triggerdata-state'open' | 'closed'
triggerdata-streaming'' (present only while the condition holds)
triggerdata-xh-action-control''
triggerdata-xh-action-display'always'
triggerdata-xh-action-profile'disclosure-trigger'
triggerdata-xh-action-sizeprops.size
triggerdata-xh-action-variant'ghost'
icondata-streaming'' (present only while the condition holds)
indicatordata-instant'' (present only while the condition holds)
indicatordata-state'open' | 'closed'
labeldata-instant'' (present only while the condition holds)
labeldata-streaming'' (present only while the condition holds)
durationdata-instant'' (present only while the condition holds)
durationdata-streaming'' (present only while the condition holds)
contentdata-instant'' (present only while the condition holds)
contentdata-state'open' | 'closed'

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-reasoning-bgrootbackgrounddefault
variant=outline
variant=subtle
--xh-bg-subtle
--xh-bg-surface
--xh-reasoning-borderrootborderdefault
variant=outline
--xh-border-default
--xh-reasoning-content-fgcontentcolordefault--xh-fg-muted
--xh-reasoning-content-font-sizecontentfont-sizedefault--xh-text-secondary-size
--xh-reasoning-content-leadingcontentline-heightdefault--xh-text-prose-leading
--xh-reasoning-content-pecontentpadding-inline-enddefault--xh-reasoning-px
--xh-reasoning-content-pscontentpadding-inline-startdefault--xh-space-3
--xh-reasoning-duration-fgdurationcolordefault--xh-fg-subtle
--xh-reasoning-duration-font-sizedurationfont-sizedefault--xh-text-caption-size
--xh-reasoning-font-sizetriggerfont-sizedefault--xh-_reasoning-font-size
--xh-reasoning-icon-fgiconcolordefault--xh-fg-subtle
--xh-reasoning-icon-sizeroot--xh-icon-sizedefault--xh-_reasoning-icon-size
--xh-reasoning-icon-streaming-fgiconcolorstreaming--xh-fg-muted
--xh-reasoning-indicator-fgindicatorcolordefault--xh-fg-subtle
--xh-reasoning-label-font-weightlabelfont-weightdefault--xh-text-label-weight
--xh-reasoning-label-streaming-fglabelcolor@media (prefers-reduced-motion: reduce)
@media print
motion=reduce
streaming
where([data-motion='reduce'])
--xh-fg-default
--xh-reasoning-pxcontent
trigger
margin-inline-start
padding-inline
padding-inline-end
default--xh-_reasoning-px
--xh-reasoning-pycontent
trigger
padding-block
padding-block-end
@keyframes xh-disclosure-collapse
@keyframes xh-disclosure-expand
default
xh-action-profile=disclosure-trigger
--xh-_reasoning-py
--xh-reasoning-radiusrootborder-radiusdefault--xh-shape-surface
--xh-reasoning-railcontentborder-inline-startdefault--xh-border-subtle
--xh-reasoning-rail-insetcontentmargin-inline-startdefault--xh-reasoning-px
--xh-reasoning-rail-widthcontentborder-inline-startdefault--xh-stroke-thin
--xh-reasoning-shadowrootbox-shadowdefault
tone
0 0 0 transparent
none
--xh-reasoning-shimmer-durationlabelanimationstreaming--xh-motion-loop-shimmer
--xh-reasoning-shimmer-fromlabelbackground-imagestreaming--xh-fg-subtle
--xh-reasoning-shimmer-tolabelbackground-imagestreaming--xh-fg-default
--xh-reasoning-tone-barrootbox-shadowtone--xh-stroke-thick
--xh-reasoning-tone-fgrootbox-shadowtone--xh-_tone-soft
--xh-reasoning-trigger-bg-hovertriggerbackground-colordisabled
hover
loading
not([data-disabled])
not([data-loading])
--xh-_action-variant-bg-hover
--xh-reasoning-trigger-fgtriggercolordefault
disabled
hover
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-fg-muted
--xh-reasoning-trigger-gaptriggergapdefault--xh-space-2
--xh-reasoning-trigger-radiusroot
trigger
border-radiusvariant=ghost--xh-shape-control

Released under The MIT License