@ariakit/react-core
Version:
Ariakit React core
52 lines (51 loc) • 2.21 kB
text/typescript
import type { ElementType } from "react";
import type { GroupLabelOptions } from "../group/group-label.tsx";
import type { Props } from "../utils/types.ts";
import type { CompositeStore } from "./composite-store.ts";
declare const TagName = "div";
type TagName = typeof TagName;
/**
* Returns props to create a `CompositeGroupLabel` component. This hook must be
* used in a component that's wrapped with `CompositeGroup` so the
* `aria-labelledby` prop is properly set on the composite group element.
* @see https://ariakit.org/components/composite
* @example
* ```jsx
* // This component must be wrapped with CompositeGroup
* const props = useCompositeGroupLabel();
* <Role {...props}>Label</Role>
* ```
*/
export declare const useCompositeGroupLabel: import("../utils/types.ts").Hook<"div", CompositeGroupLabelOptions<"div">>;
/**
* Renders a label in a composite group. This component must be wrapped with
* [`CompositeGroup`](https://ariakit.org/reference/composite-group) so the
* `aria-labelledby` prop is properly set on the group element.
* @see https://ariakit.org/components/composite
* @example
* ```jsx {4}
* <CompositeProvider>
* <Composite>
* <CompositeGroup>
* <CompositeGroupLabel>Label</CompositeGroupLabel>
* <CompositeItem>Item 1</CompositeItem>
* <CompositeItem>Item 2</CompositeItem>
* </CompositeGroup>
* </Composite>
* </CompositeProvider>
* ```
*/
export declare const CompositeGroupLabel: (props: CompositeGroupLabelProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export interface CompositeGroupLabelOptions<T extends ElementType = TagName> extends GroupLabelOptions<T> {
/**
* Object returned by the
* [`useCompositeStore`](https://ariakit.org/reference/use-composite-store)
* hook. If not provided, the closest
* [`Composite`](https://ariakit.org/reference/composite) or
* [`CompositeProvider`](https://ariakit.org/reference/composite-provider)
* components' context will be used.
*/
store?: CompositeStore;
}
export type CompositeGroupLabelProps<T extends ElementType = TagName> = Props<T, CompositeGroupLabelOptions<T>>;
export {};