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.

33 lines (32 loc) 765 B
'use client'; import { useRenderElement } from "../../utils/useRenderElement.js"; import { useCompositeItem } from "./useCompositeItem.js"; import { EMPTY_OBJECT, EMPTY_ARRAY } from "../../utils/constants.js"; /** * @internal */ export function CompositeItem(componentProps) { const { render, className, state = EMPTY_OBJECT, props = EMPTY_ARRAY, refs = EMPTY_ARRAY, metadata, stateAttributesMapping, tag = 'div', ...elementProps } = componentProps; const { compositeProps, compositeRef } = useCompositeItem({ metadata }); return useRenderElement(tag, componentProps, { state, ref: [...refs, compositeRef], props: [compositeProps, ...props, elementProps], stateAttributesMapping }); }