@adaptui/react
Version:
Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit
64 lines (63 loc) • 2.08 kB
TypeScript
import { RoleOptions } from "ariakit";
import { DisclosureState } from "ariakit/disclosure";
import { As, Props } from "ariakit-utils/types";
/**
* A component hook that returns props that can be passed to `Role` or any other
* Ariakit component to render an element that can be shown or hidden.
* @see https://ariakit.org/components/disclosure
* @example
* ```jsx
* const state = useDisclosureState();
* const props = useDisclosureCollapsibleContent({ state });
* <Disclosure state={state}>Disclosure</Disclosure>
* <Role {...props}>Content</Role>
* ```
*/
export declare const useDisclosureCollapsibleContent: import("ariakit-utils/types").Hook<DisclosureCollapsibleContentOptions<"div">>;
export declare const DisclosureCollapsibleContent: import("ariakit-utils/types").Component<DisclosureCollapsibleContentOptions<"div">>;
export declare type DisclosureCollapsibleContentOptions<T extends As = "div"> = RoleOptions<T> & {
/**
* Object returned by the `useDisclosureState` hook.
*/
state: DisclosureState;
/**
* Direction of the transition.
*
* @default vertical
*/
direction?: "vertical" | "horizontal";
/**
* Size of the content.
*
* @default 0
*/
contentSize?: number;
/**
* Transition Easing.
*
* @default cubic-bezier(0.4, 0, 0.2, 1)
*/
easing?: string;
/**
* Duration of the transition.
* By default the duration is calculated based on the size of change.
*/
duration?: number;
/**
* Callback called before the expand transition starts.
*/
onExpandStart?: () => void;
/**
* Callback called after the expand transition ends.
*/
onExpandEnd?: () => void;
/**
* Callback called before the collapse transition starts.
*/
onCollapseStart?: () => void;
/**
* Callback called after the collapse transition ends..
*/
onCollapseEnd?: () => void;
};
export declare type DisclosureCollapsibleContentProps<T extends As = "div"> = Props<DisclosureCollapsibleContentOptions<T>>;