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

查看生态总览
Skip to content

ButtonGroup ​

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="button-group": root

API reference ​

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

Artifacts ​

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

Props ​

PropTypeRequired
disabledboolean
fullWidthboolean
orientation'horizontal' | 'vertical'
separatorsboolean
sizeSize
toneTone
variantActionVariant

connect API ​

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

MemberType
orientation'horizontal' | 'vertical'
disabledboolean
separatorsboolean
variantActionVariant
toneTone | undefined
sizeSize | undefined
getRootProps() => 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
rootrole'group'

Style reference ​

Skin ​

@xihan-ui/styles/button-group.css is written against [data-scope="button-group"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-button-group 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-disabled'' (present only while the condition holds)
rootdata-full-width'' (present only while the condition holds)
rootdata-orientationprops.orientation
rootdata-sizeprops.size
rootdata-toneprops.tone
rootdata-variantprops.variant

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-button-group-outline-colorrootbordervariant=outline--xh-_tone-border-control
--xh-button-group-radiusrootborder-end-end-radius
border-end-start-radius
border-radius
border-start-end-radius
border-start-start-radius
first-child
last-child
orientation=horizontal
orientation=vertical
variant=outline
--xh-shape-control
--xh-button-group-separator-colorrootbackgroundxh-button-group-separator--xh-fg-default
--xh-button-group-separator-color-disabledrootbackgrounddisabled
xh-button-group-separator
--xh-border-subtle
--xh-button-group-separator-opacityrootopacityxh-button-group-separator--xh-control-separator-opacity
--xh-button-group-separator-opacity-disabledrootopacitydisabled
xh-button-group-separator
--xh-control-separator-disabled-opacity
--xh-button-group-separator-radiusrootborder-radiusxh-button-group-separator--xh-shape-pill
--xh-button-group-separator-sizerootblock-size
inline-size
orientation=horizontal
orientation=vertical
xh-button-group-separator
--xh-_group-separator-size
--xh-button-group-separator-thicknessrootblock-size
inline-size
margin-block-start
margin-inline-start
orientation=horizontal
orientation=vertical
xh-button-group-separator
--xh-stroke-thin

Released under The MIT License