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

查看生态总览
Skip to content

Popconfirm ​

Overlays 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="popconfirm": root · trigger · positioner · content · title · description · confirm-trigger · cancel-trigger · arrow

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-popconfirm>
Vue componentsXhPopconfirmArrow XhPopconfirmCancelTrigger XhPopconfirmConfirmTrigger XhPopconfirmContent XhPopconfirmDescription XhPopconfirmPositioner XhPopconfirmRoot XhPopconfirmTitle XhPopconfirmTrigger
ComposableusePopconfirm
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/popconfirm.css

Props ​

PropTypeRequired
closeOnEscapeboolean
closeOnInteractOutsideboolean
defaultOpenboolean
dirDirection
disabledboolean
offsetnumber
onCancelPress() => void
onConfirm() => void | PromiseLike<unknown>
onConfirmError(details: PopconfirmConfirmErrorDetails) => void
onOpenChange(details: PopoverOpenChangeDetails) => void
openboolean
partsTitleDescriptionParts
placementPlacement
sizeSize

Events ​

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

EventPayload
open-changePopoverOpenChangeDetails
confirm``
confirm-errorPopconfirmConfirmErrorDetails
cancel-press``

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhPopconfirmRootdefaultPopconfirmRootSlotProps

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
XhPopconfirmPositionercontainer() => Element | null
XhPopconfirmRootchildrenSlotChildren<PopconfirmRootSlotProps>

State ​

Public state is written to data-state.

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

connect API ​

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

MemberType
openboolean
pendingboolean
actionErrorPopconfirmConfirmErrorDetails | null
setOpen(next: boolean) => void
confirm() => void
cancel() => void
getRootProps() => T['element']
getTriggerProps() => T['button']
getPositionerProps() => T['element']
getContentProps() => T['element']
getTitleProps() => T['element']
getDescriptionProps() => T['element']
getConfirmTriggerProps() => T['button']
getCancelTriggerProps() => T['button']
getArrowProps() => 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 / Spacepopconfirm.kbd.toggle-on-trigger
Enter / Spacepopconfirm.kbd.confirm
Enter / Spacepopconfirm.kbd.cancel
Escapepopconfirm.kbd.escape
Enter / Spacepopconfirm.kbd.press

ARIA ​

These attributes are produced by connect.

PartAttributeValue
triggeraria-controlsid of the content part
triggeraria-expanded'true' | 'false'
triggeraria-haspopup'dialog'
contentaria-describedbyid of the description part | undefined
contentaria-hidden!open || undefined
contentaria-labelledbyid of the title part | undefined
contentrole'dialog'
confirm-triggeraria-busy'true' | undefined
confirm-triggeraria-disabled'true' | undefined
arrowaria-hidden'true'

Style reference ​

Skin ​

@xihan-ui/styles/popconfirm.css is written against [data-scope="popconfirm"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-popconfirm 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-state'open' | 'closed'
triggerdata-disabled'' (present only while the condition holds)
triggerdata-pressed'' (present only while the condition holds)
triggerdata-state'open' | 'closed'
triggerdata-xh-action-control''
triggerdata-xh-action-display'always'
triggerdata-xh-action-profile'text'
triggerdata-xh-action-size'md'
triggerdata-xh-action-variant'outline'
positionerdata-hidden'' (present only while the condition holds)
positionerdata-placementactual placement computed by the positioning engine
positionerdata-positioned'' (present only while the condition holds)
positionerdata-state'open' | 'closed'
contentdata-instant'' (present only while the condition holds)
contentdata-placementactual placement computed by the positioning engine
contentdata-sizeprops.size
contentdata-state'open' | 'closed'
contentdata-xh-material'frosted'
confirm-triggerdata-loading'' (present only while the condition holds)
confirm-triggerdata-pressed'' (present only while the condition holds)
confirm-triggerdata-xh-action-control''
confirm-triggerdata-xh-action-display'always'
confirm-triggerdata-xh-action-profile'text'
confirm-triggerdata-xh-action-size'sm'
confirm-triggerdata-xh-action-variant'solid'
confirm-triggerdata-xh-ink-surface''
confirm-triggerdata-xh-loading-ring'overlay'
cancel-triggerdata-pressed'' (present only while the condition holds)
cancel-triggerdata-xh-action-control''
cancel-triggerdata-xh-action-display'always'
cancel-triggerdata-xh-action-profile'text'
cancel-triggerdata-xh-action-size'sm'
cancel-triggerdata-xh-action-variant'outline'
arrowdata-placementactual placement computed by the positioning engine

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-popconfirm-action-font-weightcancel-trigger
confirm-trigger
font-weightdefault--xh-text-label-weight
--xh-popconfirm-action-mtcancel-trigger
confirm-trigger
margin-block-startdefault--xh-space-3
--xh-popconfirm-action-pxcancel-trigger
confirm-trigger
padding-inlinedefault--xh-_action-profile-padding-inline
--xh-popconfirm-action-radiuscancel-trigger
confirm-trigger
border-radiusdefault--xh-shape-control
--xh-popconfirm-action-shadowcancel-trigger
confirm-trigger
box-shadowdefaultnone
--xh-popconfirm-arrow-sizearrow--xh-_overlay-arrow-sizedefault--xh-overlay-arrow-size
--xh-popconfirm-backdropcontent-webkit-backdrop-filter
backdrop-filter
xh-material=frosted--xh-_material-backdrop
--xh-popconfirm-bgarrow
content
backgrounddefault
not([data-xh-action-control])
xh-material=frosted
--xh-_material-bg
--xh-material-frosted-bg
--xh-popconfirm-borderarrow
content
borderdefault
not([data-xh-action-control])
xh-material=frosted
--xh-_material-border
--xh-material-frosted-border
--xh-popconfirm-cancel-bgcancel-trigger--xh-ink-surface
background-color
default
focus-visible
xh-ink-surface
transparent
--xh-popconfirm-cancel-bg-activecancel-triggerbackground-colordisabled
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-bg-subtle-hover
--xh-popconfirm-cancel-bg-focuscancel-triggerbackground-colorfocus-visible--xh-popconfirm-cancel-bg
--xh-popconfirm-cancel-bg-hovercancel-triggerbackground-colordisabled
hover
loading
not([data-disabled])
not([data-loading])
--xh-bg-subtle
--xh-popconfirm-cancel-bordercancel-triggerborder
border-color
default
focus-visible
--xh-border-control
--xh-popconfirm-cancel-border-hovercancel-triggerborder-colordisabled
hover
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-border-control-hover
--xh-popconfirm-cancel-fgcancel-triggercolordefault
disabled
focus-visible
hover
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-fg-default
--xh-popconfirm-cancel-fg-focuscancel-triggercolorfocus-visible--xh-popconfirm-cancel-fg
--xh-popconfirm-column-gapcontentcolumn-gapdefault--xh-popconfirm-gap
--xh-popconfirm-confirm-bgconfirm-trigger--xh-ink-surface
background-color
default
focus-visible
loading
xh-ink-surface
--xh-_action-variant-bg-focus-visible
--xh-_action-variant-bg-loading
--xh-_action-variant-bg-rest
--xh-popconfirm-confirm-fgconfirm-triggerborder
border-color
color
@media (prefers-reduced-motion: reduce)
@media print
default
disabled
focus-visible
hover
is(:active, [data-pressed])
loading
motion=reduce
not([data-disabled])
not([data-loading])
pressed
where([data-motion='reduce'])
xh-loading-ring
xh-loading-ring=overlay
--xh-_action-variant-fg-focus-visible
--xh-_action-variant-fg-hover
--xh-_action-variant-fg-loading
--xh-_action-variant-fg-pressed
--xh-_action-variant-fg-rest
--xh-popconfirm-confirm-shadowconfirm-triggerbox-shadowdefault--xh-popconfirm-action-shadow
--xh-popconfirm-description-fgdescriptioncolordefault--xh-fg-muted
--xh-popconfirm-description-font-sizedescriptionfont-sizedefault--xh-text-body-size
--xh-popconfirm-fgcontentcolornot([data-xh-action-control])
xh-material=frosted
--xh-_material-fg
--xh-popconfirm-gapcontentcolumn-gap
gap
default--xh-space-1
--xh-space-2
--xh-popconfirm-icon-sizecancel-trigger
confirm-trigger
content
trigger
--xh-icon-sizedefault--xh-_action-profile-glyph-size
--xh-glyph-size-md
--xh-popconfirm-layerpositionerz-indexdefault--xh-_layer
--xh-popconfirm-loading-durationconfirm-triggeranimationxh-loading-ring--xh-motion-loop-spin
--xh-popconfirm-max-hcontentmax-block-sizedefault--xh-overlay-max-h
--xh-popconfirm-max-wcontentmax-inline-sizedefault--xh-_popconfirm-max-w
--xh-popconfirm-pxcontentpadding-inlinedefault--xh-_popconfirm-px
--xh-popconfirm-pycontentpadding-blockdefault--xh-_popconfirm-py
--xh-popconfirm-radiuscontentborder-radiusdefault--xh-shape-overlay
--xh-popconfirm-shadowcontentbox-shadownot([data-xh-action-control])
xh-material=frosted
--xh-_material-shadow
--xh-popconfirm-title-fgtitlecolordefault--xh-material-frosted-fg
--xh-popconfirm-title-font-sizetitlefont-sizedefault--xh-text-label-size
--xh-popconfirm-title-font-weighttitlefont-weightdefault--xh-font-weight-medium

Released under The MIT License