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

Function MenuItem

starters/tailwind/src/Menu.tsx:33–53  ·  view source on GitHub ↗
(props: MenuItemProps)

Source from the content-addressed store, hash-verified

31}
32
33export function MenuItem(props: MenuItemProps) {
34 let textValue =
35 props.textValue || (typeof props.children === 'string' ? props.children : undefined);
36 return (
37 <AriaMenuItem textValue={textValue} {...props} className={dropdownItemStyles}>
38 {composeRenderProps(props.children, (children, {selectionMode, isSelected, hasSubmenu}) => (
39 <>
40 {selectionMode !== 'none' && (
41 <span className="flex items-center w-4">
42 {isSelected && <Check aria-hidden className="w-4 h-4" />}
43 </span>
44 )}
45 <span className="flex items-center flex-1 gap-2 font-normal truncate group-selected:font-semibold">
46 {children}
47 </span>
48 {hasSubmenu && <ChevronRight aria-hidden className="absolute w-4 h-4 right-2" />}
49 </>
50 ))}
51 </AriaMenuItem>
52 );
53}
54
55export function MenuSeparator(props: SeparatorProps) {
56 return (

Callers

nothing calls this directly

Calls 1

composeRenderPropsFunction · 0.85

Tested by

no test coverage detected