UNPKG

@trail-ui/react

Version:
20 lines (18 loc) 882 B
// src/listbox/listbox-section.tsx import { clsx } from "@trail-ui/shared-utils"; import { menuSection } from "@trail-ui/theme"; import { useMemo } from "react"; import { Header, Section } from "react-aria-components"; import { Fragment, jsx, jsxs } from "react/jsx-runtime"; function ListBoxSection(props) { const { title, children, className, classNames, ...otherProps } = props; const slots = useMemo(() => menuSection(), []); const baseStyles = clsx(classNames == null ? void 0 : classNames.base, className); return /* @__PURE__ */ jsxs(Section, { "data-group": "true", className: slots.base({ class: baseStyles }), ...otherProps, children: [ /* @__PURE__ */ jsx(Header, { className: slots.header({ class: classNames == null ? void 0 : classNames.header }), children: title }), /* @__PURE__ */ jsx(Fragment, { children }) ] }); } export { ListBoxSection };