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.

32 lines (30 loc) 895 B
'use client'; import * as React from 'react'; import { useRenderElement } from "../utils/useRenderElement.js"; /** * A separator element accessible to screen readers. * Renders a `<div>` element. * * Documentation: [Base UI Separator](https://base-ui.com/react/components/separator) */ export const Separator = /*#__PURE__*/React.forwardRef(function SeparatorComponent(componentProps, forwardedRef) { const { className, render, orientation = 'horizontal', ...elementProps } = componentProps; const state = React.useMemo(() => ({ orientation }), [orientation]); const element = useRenderElement('div', componentProps, { state, ref: forwardedRef, props: [{ role: 'separator', 'aria-orientation': orientation }, elementProps] }); return element; }); if (process.env.NODE_ENV !== "production") Separator.displayName = "Separator";