UNPKG

@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.

21 lines (20 loc) 697 B
'use client'; import * as React from 'react'; import { NOOP } from "../utils/noop.js"; /** * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\ * with an accessible name (label) and description. */ export const LabelableContext = /*#__PURE__*/React.createContext({ controlId: undefined, setControlId: NOOP, labelId: undefined, setLabelId: NOOP, messageIds: [], setMessageIds: NOOP, getDescriptionProps: externalProps => externalProps }); if (process.env.NODE_ENV !== "production") LabelableContext.displayName = "LabelableContext"; export function useLabelableContext() { return React.useContext(LabelableContext); }