UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

48 lines (47 loc) 1.44 kB
import { CollapsibleBaseProps } from "./Collapsible.types"; export type CollapsibleContextProps = Pick<CollapsibleBaseProps, "open"> & { /** * Allows connecting trigger to content */ contentId: string; /** * Allows connecting content to trigger */ triggerId: string; /** * Callback for toggling open state */ onOpenToggle: () => void; /** * Allows always rendering children in content when closed */ lazy: boolean; /** * Utility for getting state as string. Usefull for data-attributes. */ state: "open" | "closed"; }; export declare const CollapsibleContextProvider: import("react").ForwardRefExoticComponent<Pick<CollapsibleBaseProps, "open"> & { /** * Allows connecting trigger to content */ contentId: string; /** * Allows connecting content to trigger */ triggerId: string; /** * Callback for toggling open state */ onOpenToggle: () => void; /** * Allows always rendering children in content when closed */ lazy: boolean; /** * Utility for getting state as string. Usefull for data-attributes. */ state: "open" | "closed"; } & { children: React.ReactNode; } & import("react").RefAttributes<unknown>>, useCollapsibleContext: <S extends boolean = true>(strict?: S) => S extends true ? CollapsibleContextProps : CollapsibleContextProps | undefined;