/** * @license EUPL-1.2+ * Copyright Gemeente Amsterdam */ type UseCollapsibleProps = { /** * The uncontrolled initial value. Read only when the component mounts, so later changes are ignored. * Overridden by `value` when the component is controlled. */ defaultValue?: boolean; /** The value to fall back to when neither `value` nor `defaultValue` is provided. */ fallback?: boolean; /** * Whether the collapsible behaviour is active at all. When `false`, the state is inert: * `value` no longer affects the returned state and `toggle` does nothing. Defaults to `true`. */ gate?: boolean; /** Fired on every toggle with the next value. Fires in both controlled and uncontrolled modes. */ onToggle?: (next: boolean) => void; /** The controlled value. When provided (and `gate` is `true`), the component is controlled. */ value?: boolean; }; /** * Drives the shared controlled/uncontrolled behaviour of a collapsible component. * * Pass `value` to control the component from a parent; leave it undefined to let the component * hold its own state, seeded once by `defaultValue` (or `fallback`). `onToggle` always fires with * the next value, so a controlled parent can update `value` and an uncontrolled consumer can observe * changes. The internal state is only mutated when uncontrolled, so the two modes never fight. * * @returns A tuple of the current value, a toggle function, and whether the component is controlled. */ export declare const useCollapsible: ({ defaultValue, fallback, gate, onToggle, value, }: UseCollapsibleProps) => readonly [boolean, () => void, boolean]; export {};