@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
49 lines (48 loc) • 1.4 kB
TypeScript
import { CollapsibleBaseProps } from "./Collapsible.types.js";
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").FC<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;
ref?: never;
}>, useCollapsibleContext: <S extends boolean = true>(strict?: S | undefined) => S extends true ? CollapsibleContextProps : CollapsibleContextProps | undefined;