@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.
38 lines (37 loc) • 1.45 kB
TypeScript
import * as React from 'react';
export declare function useCollapsiblePanel(parameters: useCollapsiblePanel.Parameters): useCollapsiblePanel.ReturnValue;
export declare namespace useCollapsiblePanel {
interface Parameters {
/**
* Allows the browser’s built-in page search to find and expand the panel contents.
*
* Overrides the `keepMounted` prop and uses `hidden="until-found"`
* to hide the element without removing it from the DOM.
*/
hiddenUntilFound: boolean;
panelId: React.HTMLAttributes<Element>['id'];
/**
* Whether to keep the element in the DOM while the panel is closed.
* This prop is ignored when `hiddenUntilFound` is used.
*/
keepMounted: boolean;
mounted: boolean;
/**
* Whether the collapsible panel is currently open.
*/
open: boolean;
ref: React.Ref<HTMLElement>;
setPanelId: (id: string | undefined) => void;
setOpen: (nextOpen: boolean) => void;
setMounted: (nextMounted: boolean) => void;
}
interface ReturnValue {
getRootProps: (externalProps?: React.ComponentPropsWithRef<'button'>) => React.ComponentPropsWithRef<'button'>;
height: number;
width: number;
/**
* The open state of the panel, that accounts for animation/transition status.
*/
isOpen: boolean;
}
}