@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
46 lines • 1.98 kB
TypeScript
import * as React from 'react';
import { BaseUIComponentProps } from "../../utils/types.js";
import { useCollapsibleRoot } from "./useCollapsibleRoot.js";
import type { BaseUIChangeEventDetails } from "../../utils/createBaseUIEventDetails.js";
import { REASONS } from "../../utils/reasons.js";
/**
* Groups all parts of the collapsible.
* Renders a `<div>` element.
*
* Documentation: [Base UI Collapsible](https://base-ui.com/react/components/collapsible)
*/
export declare const CollapsibleRoot: React.ForwardRefExoticComponent<CollapsibleRootProps & React.RefAttributes<HTMLDivElement>>;
export interface CollapsibleRootState extends Pick<useCollapsibleRoot.ReturnValue, 'open' | 'disabled'> {}
export interface CollapsibleRootProps extends Omit<BaseUIComponentProps<'div', CollapsibleRoot.State>, 'render'> {
/**
* Whether the collapsible panel is currently open.
*
* To render an uncontrolled collapsible, use the `defaultOpen` prop instead.
*/
open?: boolean;
/**
* Whether the collapsible panel is initially open.
*
* To render a controlled collapsible, use the `open` prop instead.
* @default false
*/
defaultOpen?: boolean;
/**
* Event handler called when the panel is opened or closed.
*/
onOpenChange?: (open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => void;
/**
* Whether the component should ignore user interaction.
* @default false
*/
disabled?: boolean;
render?: BaseUIComponentProps<'div', CollapsibleRootState>['render'] | null;
}
export type CollapsibleRootChangeEventReason = typeof REASONS.triggerPress | typeof REASONS.none;
export type CollapsibleRootChangeEventDetails = BaseUIChangeEventDetails<CollapsibleRootChangeEventReason>;
export declare namespace CollapsibleRoot {
type State = CollapsibleRootState;
type Props = CollapsibleRootProps;
type ChangeEventReason = CollapsibleRootChangeEventReason;
type ChangeEventDetails = CollapsibleRootChangeEventDetails;
}