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

查看生态总览
Skip to content

Resizable ​

Layout 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="resizable": root · handle

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-resizable>
Vue componentsXhResizableHandle XhResizableRoot
ComposableuseResizable
State machineresizableMachine
Skin@xihan-ui/styles/resizable.css

Props ​

PropTypeRequired
dimensionsResizableDimensions
defaultDimensionsResizableDimensions
minWidthnumber
minHeightnumber
maxWidthnumber
maxHeightnumber
aspectRationumber
stepnumber
keyboardStepnumber
keyboardLargeStepnumber
edgesResizeEdge[]
disabledboolean
dirDirection
translationsPartial<ResizableTranslations>
onDimensionsChange(details: ResizableDimensionsChangeDetails) => void
onDimensionsChangeEnd(details: ResizableDimensionsChangeEndDetails) => void

Events ​

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

EventPayload
dimensions-changeResizableDimensionsChangeDetails
dimensions-change-endResizableDimensionsChangeEndDetails

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhResizableHandledefault—
XhResizableRootdefaultResizableRootSlotProps

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
XhResizableHandleedgeResizeEdgeYes
XhResizableRootchildrenSlotChildren<ResizableRootSlotProps>

State ​

The following names are internal to the state machine.

States: idle · resizing

Events: RESIZE.START · RESIZE.MOVE · RESIZE.END · RESIZE.CANCEL · RESIZE.NUDGE · RESIZE.TO_BOUND · DIMENSIONS.SET

Guards: canResize

connect API ​

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

MemberType
dimensionsResizableDimensions
offsetResizableOffset
resizingboolean
activeEdgeResizeEdge | null
disabledboolean
edgeEnabled(edge: ResizeEdge) => boolean
setDimensions(dimensions: ResizableDimensions) => void
getRootProps() => T['element']
getHandleProps(props: { edge: ResizeEdge }) => 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
ArrowRight / ArrowDownresizable.kbd.push
ArrowLeft / ArrowUpresizable.kbd.pull
Shift+ArrowRight / Shift+ArrowLeft / Shift+ArrowUp / Shift+ArrowDownresizable.kbd.large
Homeresizable.kbd.min
Endresizable.kbd.max
Escaperesizable.kbd.cancel

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootaria-labeltranslations.root
rootrole'group'
handlearia-disabled'false' | 'true'
handlearia-labeltranslations.handle(edge)
handlearia-orientation'horizontal' | 'vertical'
handlearia-valuenowMath.round(edge === 'n' || edge === 's' ? dimensions.…
handlerole'separator'

Style reference ​

Skin ​

@xihan-ui/styles/resizable.css is written against [data-scope="resizable"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-resizable 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-edgecontext.get('activeEdge')
rootdata-resizing'' (present only while the condition holds)
handledata-disabled'' (present only while the condition holds)
handledata-edgeedge
handledata-resizing'' (present only while the condition holds)

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-resizable-cornerhandleblock-size
inline-size
edge=ne
edge=nw
edge=se
edge=sw
--xh-space-4
--xh-resizable-corner-insethandleinset-block-end
inset-block-start
inset-inline-end
inset-inline-start
edge=ne
edge=nw
edge=se
edge=sw
0
--xh-resizable-griphandleblock-size
inline-size
inset-block
inset-inline
edge=e
edge=n
edge=s
edge=w
--xh-space-2
--xh-resizable-handle-bghandlebackground
border
default
edge=ne
edge=nw
edge=se
edge=sw
is([data-edge='ne'], [data-edge='nw'], [data-edge='se'], [data-edge='sw'])
--xh-fg-default
--xh-resizable-handle-bg-activehandlebackground
border
edge=ne
edge=nw
edge=se
edge=sw
is([data-edge='ne'], [data-edge='nw'], [data-edge='se'], [data-edge='sw'])
resizing
--xh-bg-brand
--xh-resizable-handle-bg-hoverhandlebackground
border
edge=ne
edge=nw
edge=se
edge=sw
hover
is([data-edge='ne'], [data-edge='nw'], [data-edge='se'], [data-edge='sw'])
--xh-fg-default
--xh-resizable-handle-radiushandleborder-radiusdefault--xh-shape-pill
--xh-resizable-indicator-insethandleinset-block-end
inset-block-start
inset-inline-end
inset-inline-start
edge=e
edge=n
edge=s
edge=w
0
--xh-resizable-indicator-lengthhandleblock-size
inline-size
edge=e
edge=n
edge=s
edge=w
is([data-edge='e'], [data-edge='w'])
is([data-edge='n'], [data-edge='s'])
--xh-space-8
--xh-resizable-indicator-thicknesshandleblock-size
border-block-end-width
border-block-start-width
border-inline-end-width
border-inline-start-width
inline-size
edge=e
edge=n
edge=ne
edge=nw
edge=s
edge=se
edge=sw
edge=w
is([data-edge='e'], [data-edge='w'])
is([data-edge='n'], [data-edge='s'])
--xh-stroke-strong

Released under The MIT License