组件Navigation
Collapsible
@mox-hub/ui 组件 · Navigation · standby
collapsible@mox-hub/uiNavigationstandbysrc/components/collapsible.tsx变体演示collapsible
Props API
| Prop | 类型 | 默认值 | 说明 |
|---|---|---|---|
| open | boolean | — | Whether the collapsible panel is currently open. |
| defaultOpen | boolean | — | Whether the collapsible panel is initially open. |
| onOpenChange | (open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => void | — | Event handler called when the panel is opened or closed. |
| disabled | boolean | — | Whether the component should ignore user interaction. |
| slot | string | — | — |
| title | string | — | — |
| ref | Ref<HTMLDivElement> | — | Allows getting a ref to the component instance. |
| key | Key | — | — |
| suppressContentEditableWarning | boolean | — | — |
| suppressHydrationWarning | boolean | — | — |
| accessKey | string | — | — |
| autoCapitalize | "none" | "off" | "on" | "sentences" | "words" | "characters" | (string & {}) | — | — |
| autoFocus | boolean | — | — |
| contentEditable | Booleanish | "inherit" | "plaintext-only" | — | — |
| contextMenu | string | — | — |
| dir | string | — | — |
| draggable | Booleanish | — | — |
| enterKeyHint | "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | — | — |
| hidden | boolean | — | — |
| id | string | — | — |
| lang | string | — | — |
| nonce | string | — | — |
| spellCheck | Booleanish | — | — |
| tabIndex | number | — | — |
| translate | "yes" | "no" | — | — |
| radioGroup | string | — | — |
| role | AriaRole | — | — |
| about | string | — | — |
| content | string | — | — |
| datatype | string | — | — |
| inlist | any | — | — |
| prefix | string | — | — |
| property | string | — | — |
| rel | string | — | — |
| resource | string | — | — |
| rev | string | — | — |
| typeof | string | — | — |
| vocab | string | — | — |
| autoCorrect | string | — | — |
| autoSave | string | — | — |
| itemProp | string | — | — |
| itemScope | boolean | — | — |
| itemType | string | — | — |
| itemID | string | — | — |
| itemRef | string | — | — |
| results | number | — | — |
| security | string | — | — |
| unselectable | "off" | "on" | — | — |
| popover | "" | "auto" | "manual" | "hint" | — | — |
| popoverTargetAction | "toggle" | "show" | "hide" | — | — |
| popoverTarget | string | — | — |
| inert | boolean | — | — |
| 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 |
| is | string | — | Specify that a standard HTML element should behave like a defined custom built-in element |
| exportparts | string | — | — |
| part | string | — | — |
| aria-activedescendant | string | — | Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. |
| aria-atomic | Booleanish | — | 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-braillelabel | string | — | 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-brailleroledescription | string | — | Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. |
| aria-busy | Booleanish | — | — |
| aria-checked | boolean | "true" | "false" | "mixed" | — | Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. |
| aria-colcount | number | — | Defines the total number of columns in a table, grid, or treegrid. |
| aria-colindex | number | — | Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. |
| aria-colindextext | string | — | Defines a human readable text alternative of aria-colindex. |
| aria-colspan | number | — | Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. |
| aria-controls | string | — | Identifies the element (or elements) whose contents or presence are controlled by the current element. |
| aria-current | boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | — | Indicates the element that represents the current item within a container or set of related elements. |
| aria-describedby | string | — | Identifies the element (or elements) that describes the object. |
| aria-description | string | — | Defines a string value that describes or annotates the current element. |
| aria-details | string | — | Identifies the element that provides a detailed, extended description for the object. |
| aria-disabled | Booleanish | — | 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-errormessage | string | — | Identifies the element that provides an error message for the object. |
| aria-expanded | Booleanish | — | Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. |
| aria-flowto | string | — | Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, |
| aria-grabbed | Booleanish | — | Indicates an element's "grabbed" state in a drag-and-drop operation. |
| aria-haspopup | boolean | "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-hidden | Booleanish | — | Indicates whether the element is exposed to an accessibility API. |
| aria-invalid | boolean | "true" | "false" | "grammar" | "spelling" | — | Indicates the entered value does not conform to the format expected by the application. |
| aria-keyshortcuts | string | — | Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. |
| aria-label | string | — | Defines a string value that labels the current element. |
| aria-labelledby | string | — | Identifies the element (or elements) that labels the current element. |
| aria-level | number | — | 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-modal | Booleanish | — | Indicates whether an element is modal when displayed. |
| aria-multiline | Booleanish | — | Indicates whether a text box accepts multiple lines of input or only a single line. |
| aria-multiselectable | Booleanish | — | 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-owns | string | — | Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship |
| aria-placeholder | string | — | Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. |
| aria-posinset | number | — | 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-pressed | boolean | "true" | "false" | "mixed" | — | Indicates the current "pressed" state of toggle buttons. |
| aria-readonly | Booleanish | — | 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-required | Booleanish | — | Indicates that user input is required on the element before a form may be submitted. |
| aria-roledescription | string | — | Defines a human-readable, author-localized description for the role of an element. |
| aria-rowcount | number | — | Defines the total number of rows in a table, grid, or treegrid. |
| aria-rowindex | number | — | Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. |
| aria-rowindextext | string | — | Defines a human readable text alternative of aria-rowindex. |
| aria-rowspan | number | — | Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. |
| aria-selected | Booleanish | — | Indicates the current "selected" state of various widgets. |
| aria-setsize | number | — | 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-valuemax | number | — | Defines the maximum allowed value for a range widget. |
| aria-valuemin | number | — | Defines the minimum allowed value for a range widget. |
| aria-valuenow | number | — | Defines the current value for a range widget. |
| aria-valuetext | string | — | Defines the human readable text alternative of aria-valuenow for a range widget. |
| children | ReactNode | — | — |
| 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 | — | — |
| className | string | ((state: CollapsibleRootState) => string | undefined) | — | CSS class applied to the element, or a function that |
| render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsibleRootState> | — | Allows you to replace the component's HTML element |
| style | React.CSSProperties | ((state: CollapsibleRootState) => React.CSSProperties | undefined) | — | Style applied to the element, or a function that |
源码
"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/translatorprops,其次用I18nProvider目录;内置 zh-CN 默认值,en-US 为参考翻译。见Theming · i18n 与 RTL。 - 对比度:高对比度 token、2px 控件边框与 3px 焦点环由主题层统一提供,见Foundations · Contrast。
用法说明
单区展开收起原语,由 Collapsible、Trigger、Content 组成;受控用 open 与 onOpenChange。