MCPcopy Create free account
hub / github.com/adobe/react-spectrum / MenuItem

Function MenuItem

starters/docs/src/Menu.tsx:51–70  ·  view source on GitHub ↗
(props: Omit<MenuItemProps, 'children'> & {children?: React.ReactNode})

Source from the content-addressed store, hash-verified

49}
50
51export function MenuItem(props: Omit<MenuItemProps, 'children'> & {children?: React.ReactNode}) {
52 let textValue =
53 props.textValue || (typeof props.children === 'string' ? props.children : undefined);
54 return (
55 <AriaMenuItem {...props} textValue={textValue}>
56 {({hasSubmenu, isSelected, selectionMode}) => (
57 <>
58 {isSelected && selectionMode === 'multiple' ? <Check /> : null}
59 {isSelected && selectionMode === 'single' ? <Dot /> : null}
60 {typeof props.children === 'string' ? (
61 <Text slot="label">{props.children}</Text>
62 ) : (
63 props.children
64 )}
65 {hasSubmenu && <ChevronRight />}
66 </>
67 )}
68 </AriaMenuItem>
69 );
70}
71
72export function MenuSection<T>(props: MenuSectionProps<T>) {
73 return <AriaMenuSection {...props} />;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected