Ordo UI
组件Navigation

Collapsible

@mox-hub/ui 组件 · Navigation · standby

collapsible@mox-hub/uiNavigationstandbysrc/components/collapsible.tsx
变体演示collapsible

Props API

Prop类型默认值说明
openboolean—Whether the collapsible panel is currently open.
defaultOpenboolean—Whether the collapsible panel is initially open.
onOpenChange(open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => void—Event handler called when the panel is opened or closed.
disabledboolean—Whether the component should ignore user interaction.
slotstring——
titlestring——
refRef<HTMLDivElement>—Allows getting a ref to the component instance.
keyKey——
suppressContentEditableWarningboolean——
suppressHydrationWarningboolean——
accessKeystring——
autoCapitalize"none" | "off" | "on" | "sentences" | "words" | "characters" | (string & {})——
autoFocusboolean——
contentEditableBooleanish | "inherit" | "plaintext-only"——
contextMenustring——
dirstring——
draggableBooleanish——
enterKeyHint"search" | "enter" | "done" | "go" | "next" | "previous" | "send"——
hiddenboolean——
idstring——
langstring——
noncestring——
spellCheckBooleanish——
tabIndexnumber——
translate"yes" | "no"——
radioGroupstring——
roleAriaRole——
aboutstring——
contentstring——
datatypestring——
inlistany——
prefixstring——
propertystring——
relstring——
resourcestring——
revstring——
typeofstring——
vocabstring——
autoCorrectstring——
autoSavestring——
itemPropstring——
itemScopeboolean——
itemTypestring——
itemIDstring——
itemRefstring——
resultsnumber——
securitystring——
unselectable"off" | "on"——
popover"" | "auto" | "manual" | "hint"——
popoverTargetAction"toggle" | "show" | "hide"——
popoverTargetstring——
inertboolean——
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal"—Hints at the type of data that might be entered by the user while editing the element or its contents
isstring—Specify that a standard HTML element should behave like a defined custom built-in element
exportpartsstring——
partstring——
aria-activedescendantstring—Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
aria-atomicBooleanish—Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
aria-autocomplete"none" | "inline" | "list" | "both"—Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be
aria-braillelabelstring—Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.
aria-brailleroledescriptionstring—Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
aria-busyBooleanish——
aria-checkedboolean | "true" | "false" | "mixed"—Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-colcountnumber—Defines the total number of columns in a table, grid, or treegrid.
aria-colindexnumber—Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
aria-colindextextstring—Defines a human readable text alternative of aria-colindex.
aria-colspannumber—Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
aria-controlsstring—Identifies the element (or elements) whose contents or presence are controlled by the current element.
aria-currentboolean | "time" | "true" | "false" | "page" | "step" | "location" | "date"—Indicates the element that represents the current item within a container or set of related elements.
aria-describedbystring—Identifies the element (or elements) that describes the object.
aria-descriptionstring—Defines a string value that describes or annotates the current element.
aria-detailsstring—Identifies the element that provides a detailed, extended description for the object.
aria-disabledBooleanish—Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
aria-dropeffect"link" | "none" | "copy" | "execute" | "move" | "popup"—Indicates what functions can be performed when a dragged object is released on the drop target.
aria-errormessagestring—Identifies the element that provides an error message for the object.
aria-expandedBooleanish—Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-flowtostring—Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
aria-grabbedBooleanish—Indicates an element's "grabbed" state in a drag-and-drop operation.
aria-haspopupboolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree"—Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-hiddenBooleanish—Indicates whether the element is exposed to an accessibility API.
aria-invalidboolean | "true" | "false" | "grammar" | "spelling"—Indicates the entered value does not conform to the format expected by the application.
aria-keyshortcutsstring—Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
aria-labelstring—Defines a string value that labels the current element.
aria-labelledbystring—Identifies the element (or elements) that labels the current element.
aria-levelnumber—Defines the hierarchical level of an element within a structure.
aria-live"off" | "assertive" | "polite"—Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
aria-modalBooleanish—Indicates whether an element is modal when displayed.
aria-multilineBooleanish—Indicates whether a text box accepts multiple lines of input or only a single line.
aria-multiselectableBooleanish—Indicates that the user may select more than one item from the current selectable descendants.
aria-orientation"horizontal" | "vertical"—Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
aria-ownsstring—Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
aria-placeholderstring—Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
aria-posinsetnumber—Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
aria-pressedboolean | "true" | "false" | "mixed"—Indicates the current "pressed" state of toggle buttons.
aria-readonlyBooleanish—Indicates that the element is not editable, but is otherwise operable.
aria-relevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals"—Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
aria-requiredBooleanish—Indicates that user input is required on the element before a form may be submitted.
aria-roledescriptionstring—Defines a human-readable, author-localized description for the role of an element.
aria-rowcountnumber—Defines the total number of rows in a table, grid, or treegrid.
aria-rowindexnumber—Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
aria-rowindextextstring—Defines a human readable text alternative of aria-rowindex.
aria-rowspannumber—Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
aria-selectedBooleanish—Indicates the current "selected" state of various widgets.
aria-setsizenumber—Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
aria-sort"none" | "ascending" | "descending" | "other"—Indicates if items in a table or grid are sorted in ascending or descending order.
aria-valuemaxnumber—Defines the maximum allowed value for a range widget.
aria-valueminnumber—Defines the minimum allowed value for a range widget.
aria-valuenownumber—Defines the current value for a range widget.
aria-valuetextstring—Defines the human readable text alternative of aria-valuenow for a range widget.
childrenReactNode——
dangerouslySetInnerHTML{ __html: string | TrustedHTML; }——
onCopy(event: BaseUIEvent<ClipboardEvent<HTMLDivElement>>) => void——
onCopyCapture(event: BaseUIEvent<ClipboardEvent<HTMLDivElement>>) => void——
onCut(event: BaseUIEvent<ClipboardEvent<HTMLDivElement>>) => void——
onCutCapture(event: BaseUIEvent<ClipboardEvent<HTMLDivElement>>) => void——
onPaste(event: BaseUIEvent<ClipboardEvent<HTMLDivElement>>) => void——
onPasteCapture(event: BaseUIEvent<ClipboardEvent<HTMLDivElement>>) => void——
onCompositionEnd(event: BaseUIEvent<CompositionEvent<HTMLDivElement>>) => void——
onCompositionEndCapture(event: BaseUIEvent<CompositionEvent<HTMLDivElement>>) => void——
onCompositionStart(event: BaseUIEvent<CompositionEvent<HTMLDivElement>>) => void——
onCompositionStartCapture(event: BaseUIEvent<CompositionEvent<HTMLDivElement>>) => void——
onCompositionUpdate(event: BaseUIEvent<CompositionEvent<HTMLDivElement>>) => void——
onCompositionUpdateCapture(event: BaseUIEvent<CompositionEvent<HTMLDivElement>>) => void——
onFocus(event: BaseUIEvent<FocusEvent<HTMLDivElement, Element>>) => void——
onFocusCapture(event: BaseUIEvent<FocusEvent<HTMLDivElement, Element>>) => void——
onBlur(event: BaseUIEvent<FocusEvent<HTMLDivElement, Element>>) => void——
onBlurCapture(event: BaseUIEvent<FocusEvent<HTMLDivElement, Element>>) => void——
onChange(event: BaseUIEvent<ChangeEvent<HTMLDivElement, Element>>) => void——
onChangeCapture(event: BaseUIEvent<ChangeEvent<HTMLDivElement, Element>>) => void——
onBeforeInput(event: BaseUIEvent<InputEvent<HTMLDivElement>>) => void——
onBeforeInputCapture(event: BaseUIEvent<InputEvent<HTMLDivElement>>) => void——
onInput(event: BaseUIEvent<InputEvent<HTMLDivElement>>) => void——
onInputCapture(event: BaseUIEvent<InputEvent<HTMLDivElement>>) => void——
onReset(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onResetCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSubmit(event: BaseUIEvent<SubmitEvent<HTMLDivElement>>) => void——
onSubmitCapture(event: BaseUIEvent<SubmitEvent<HTMLDivElement>>) => void——
onInvalid(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onInvalidCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoad(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onError(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onErrorCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onKeyDown(event: BaseUIEvent<KeyboardEvent<HTMLDivElement>>) => void——
onKeyDownCapture(event: BaseUIEvent<KeyboardEvent<HTMLDivElement>>) => void——
onKeyPress(event: BaseUIEvent<KeyboardEvent<HTMLDivElement>>) => void——
onKeyPressCapture(event: BaseUIEvent<KeyboardEvent<HTMLDivElement>>) => void——
onKeyUp(event: BaseUIEvent<KeyboardEvent<HTMLDivElement>>) => void——
onKeyUpCapture(event: BaseUIEvent<KeyboardEvent<HTMLDivElement>>) => void——
onAbort(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onAbortCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onCanPlay(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onCanPlayCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onCanPlayThrough(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onCanPlayThroughCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onDurationChange(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onDurationChangeCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onEmptied(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onEmptiedCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onEncrypted(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onEncryptedCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onEnded(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onEndedCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadedData(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadedDataCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadedMetadata(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadedMetadataCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadStart(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onLoadStartCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onPause(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onPauseCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onPlay(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onPlayCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onPlaying(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onPlayingCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onProgress(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onProgressCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onRateChange(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onRateChangeCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSeeked(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSeekedCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSeeking(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSeekingCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onStalled(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onStalledCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSuspend(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSuspendCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onTimeUpdate(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onTimeUpdateCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onVolumeChange(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onVolumeChangeCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onWaiting(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onWaitingCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onAuxClick(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onAuxClickCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onClick(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onClickCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onContextMenu(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onContextMenuCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onDoubleClick(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onDoubleClickCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onDrag(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragEnd(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragEndCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragEnter(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragEnterCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragExit(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragExitCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragLeave(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragLeaveCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragOver(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragOverCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragStart(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDragStartCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDrop(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onDropCapture(event: BaseUIEvent<DragEvent<HTMLDivElement>>) => void——
onMouseDown(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseDownCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseEnter(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseLeave(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseMove(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseMoveCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseOut(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseOutCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseOver(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseOverCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseUp(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onMouseUpCapture(event: BaseUIEvent<MouseEvent<HTMLDivElement, globalThis.MouseEvent>>) => void——
onSelect(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onSelectCapture(event: BaseUIEvent<SyntheticEvent<HTMLDivElement, Event>>) => void——
onTouchCancel(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchCancelCapture(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchEnd(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchEndCapture(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchMove(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchMoveCapture(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchStart(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onTouchStartCapture(event: BaseUIEvent<TouchEvent<HTMLDivElement>>) => void——
onPointerDown(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerDownCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerMove(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerMoveCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerUp(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerUpCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerCancel(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerCancelCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerEnter(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerLeave(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerOver(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerOverCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerOut(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onPointerOutCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onGotPointerCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onGotPointerCaptureCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onLostPointerCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onLostPointerCaptureCapture(event: BaseUIEvent<PointerEvent<HTMLDivElement>>) => void——
onScroll(event: BaseUIEvent<UIEvent<HTMLDivElement, globalThis.UIEvent>>) => void——
onScrollCapture(event: BaseUIEvent<UIEvent<HTMLDivElement, globalThis.UIEvent>>) => void——
onScrollEnd(event: BaseUIEvent<UIEvent<HTMLDivElement, globalThis.UIEvent>>) => void——
onScrollEndCapture(event: BaseUIEvent<UIEvent<HTMLDivElement, globalThis.UIEvent>>) => void——
onWheel(event: BaseUIEvent<WheelEvent<HTMLDivElement>>) => void——
onWheelCapture(event: BaseUIEvent<WheelEvent<HTMLDivElement>>) => void——
onAnimationStart(event: BaseUIEvent<AnimationEvent<HTMLDivElement>>) => void——
onAnimationStartCapture(event: BaseUIEvent<AnimationEvent<HTMLDivElement>>) => void——
onAnimationEnd(event: BaseUIEvent<AnimationEvent<HTMLDivElement>>) => void——
onAnimationEndCapture(event: BaseUIEvent<AnimationEvent<HTMLDivElement>>) => void——
onAnimationIteration(event: BaseUIEvent<AnimationEvent<HTMLDivElement>>) => void——
onAnimationIterationCapture(event: BaseUIEvent<AnimationEvent<HTMLDivElement>>) => void——
onToggle(event: BaseUIEvent<ToggleEvent<HTMLDivElement>>) => void——
onBeforeToggle(event: BaseUIEvent<ToggleEvent<HTMLDivElement>>) => void——
onTransitionCancel(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionCancelCapture(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionEnd(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionEndCapture(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionRun(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionRunCapture(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionStart(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
onTransitionStartCapture(event: BaseUIEvent<TransitionEvent<HTMLDivElement>>) => void——
classNamestring | ((state: CollapsibleRootState) => string | undefined)—CSS class applied to the element, or a function that
renderReact.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsibleRootState>—Allows you to replace the component's HTML element
styleReact.CSSProperties | ((state: CollapsibleRootState) => React.CSSProperties | undefined)—Style applied to the element, or a function that

源码

packages/ui/src/components/collapsible.tsx
"use client"

import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"

function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
  return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
}

function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
  return (
    <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
  )
}

function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
  return (
    <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
  )
}

export { Collapsible, CollapsibleTrigger, CollapsibleContent }

可访问性与 RTL

  • 键盘:交互件保留:focus-visible焦点环;浮层支持 Escape 关闭与焦点归还,菜单 / 页签按 Base UI 约定支持方向键。 筛选菜单、拖拽排序、执行树与模型 listbox 等关键键盘流由 Playwright 断言覆盖,见规范示例 · 交互与可访问性。
  • RTL:间距、对齐与方向性图标使用逻辑属性 (ms-* /text-start /rtl:-scale-x-100);通过 ThemeProvider 或I18nProvider 的direction="rtl"驱动,`lint:rtl` 会拦截新增物理类。
  • 文案:优先用组件labels /translate /translator props,其次用I18nProvider目录;内置 zh-CN 默认值,en-US 为参考翻译。见Theming · i18n 与 RTL。
  • 对比度:高对比度 token、2px 控件边框与 3px 焦点环由主题层统一提供,见Foundations · Contrast。

用法说明

单区展开收起原语,由 Collapsible、Trigger、Content 组成;受控用 open 与 onOpenChange。