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.

15 lines (14 loc) 473 B
'use client'; import * as React from 'react'; import { mergeReactProps } from '../../utils/mergeReactProps.js'; export function useFieldsetRoot() { const [legendId, setLegendId] = React.useState(undefined); const getRootProps = React.useCallback((externalProps = {}) => mergeReactProps(externalProps, { 'aria-labelledby': legendId }), [legendId]); return React.useMemo(() => ({ getRootProps, legendId, setLegendId }), [getRootProps, legendId]); }