@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
27 lines • 1.03 kB
TypeScript
import * as React from 'react';
import { HTMLProps } from "../utils/types.js";
export interface LabelableContext {
/**
* The `id` of the labelable element.
* When `null` the association is implicit.
*/
controlId: string | null | undefined;
setControlId: React.Dispatch<React.SetStateAction<string | null | undefined>>;
/**
* The `id` of the label.
*/
labelId: string | undefined;
setLabelId: React.Dispatch<React.SetStateAction<string | undefined>>;
/**
* An array of `id`s of elements that provide an accessible description.
*/
messageIds: string[];
setMessageIds: React.Dispatch<React.SetStateAction<string[]>>;
getDescriptionProps: (externalProps: HTMLProps) => HTMLProps;
}
/**
* A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\
* with an accessible name (label) and description.
*/
export declare const LabelableContext: React.Context<LabelableContext>;
export declare function useLabelableContext(): LabelableContext;