-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
navbar-content.tsx
43 lines (34 loc) 路 1.11 KB
/
navbar-content.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {forwardRef, HTMLNextUIProps} from "@nextui-org/system";
import {useDOMRef} from "@nextui-org/react-utils";
import {clsx} from "@nextui-org/shared-utils";
import {useNavbarContext} from "./navbar-context";
export interface NavbarContentProps extends HTMLNextUIProps<"ul"> {
/**
* The content of the Navbar.Content. It is usually the `NavbarItem`,
*/
children?: React.ReactNode | React.ReactNode[];
/**
* The justify of the content
* @default start
*/
justify?: "start" | "end" | "center";
}
const NavbarContent = forwardRef<"ul", NavbarContentProps>((props, ref) => {
const {as, className, children, justify = "start", ...otherProps} = props;
const Component = as || "ul";
const domRef = useDOMRef(ref);
const {slots, classNames} = useNavbarContext();
const styles = clsx(classNames?.content, className);
return (
<Component
ref={domRef}
className={slots.content?.({class: styles})}
data-justify={justify}
{...otherProps}
>
{children}
</Component>
);
});
NavbarContent.displayName = "NextUI.NavbarContent";
export default NavbarContent;