@payfit/unity-components
Version:
31 lines (30 loc) • 1.7 kB
TypeScript
import { default as React, ReactNode } from 'react';
import { DataAttributes } from '../../../types/DataAttributes.js';
import { NavItemProps, RawNavItem } from './RawNavItem.js';
type NavGroupChildren = React.ReactElement<NavItemProps, typeof RawNavItem>;
type NavGroupProps = {
/** The child elements to be rendered inside the NavGroup. They must be `<RawNavItem>` components. */
children: NavGroupChildren | NavGroupChildren[];
/** The label to show for the NavGroup. */
label: string;
/** The prefix element to be displayed before the label. It can be any valid React element. */
prefix?: ({ isExpanded }: {
isExpanded: boolean;
}) => ReactNode;
/** The suffix element to be displayed after the label. It can be any valid React element. */
suffix?: ReactNode;
/** Whether the NavGroup is currently expanded. Use it to switch the component to a controlled mode. */
isExpanded?: boolean;
/** Whether the NavGroup is expanded by default. It only has effect in uncontrolled mode */
defaultExpanded?: boolean;
/** Callback function to be called when the NavGroup is expanded or collapsed. */
onToggle?: (isExpanded: boolean) => void;
} & DataAttributes;
/**
* The `NavGroup` component represents a tree of navigation items grouped under a single root element in a `Nav` component. It can be expanded or collapsed to show or hide its children.
*/
export declare function NavGroup({ children, label, prefix, suffix, defaultExpanded, isExpanded: controlledIsExpanded, onToggle, ...dataAttributes }: NavGroupProps): import("react/jsx-runtime").JSX.Element;
export declare namespace NavGroup {
var displayName: string;
}
export {};