@@ -10,7 +10,7 @@ import {Portal} from './portal';
1010import Box from './box' ;
1111import Inline from './inline' ;
1212import Touchable from './touchable' ;
13- import { Text3 } from './text' ;
13+ import { Text2 , Text3 } from './text' ;
1414import { vars } from './skins/skin-contract.css' ;
1515import Divider from './divider' ;
1616import Checkbox from './checkbox' ;
@@ -53,6 +53,7 @@ const getItemIndexInMenu = (menu: HTMLElement | null, item: HTMLElement | null):
5353
5454interface MenuItemBaseProps {
5555 label : string ;
56+ description ?: string ;
5657 Icon ?: ( props : IconProps ) => JSX . Element ;
5758 destructive ?: boolean ;
5859 disabled ?: boolean ;
@@ -80,6 +81,7 @@ export const MenuItem = ({
8081 onPress,
8182 controlType,
8283 checked,
84+ description,
8385 dataAttributes,
8486} : MenuItemProps ) : JSX . Element => {
8587 const { focusedItem, setFocusedItem, closeMenu, isMenuOpen} = useMenuContext ( ) ;
@@ -93,6 +95,19 @@ export const MenuItem = ({
9395
9496 const menuItemDataAttributes = { testid : 'MenuItem' , ...dataAttributes } ;
9597
98+ const renderTextContent = ( id ?: string ) => (
99+ < div id = { id } className = { styles . itemTextContent } >
100+ < Text3 regular color = { contentColor } >
101+ { label }
102+ </ Text3 >
103+ { description && (
104+ < Text2 regular color = { vars . colors . textSecondary } >
105+ { description }
106+ </ Text2 >
107+ ) }
108+ </ div >
109+ ) ;
110+
96111 const renderContent = ( ) =>
97112 controlType === 'checkbox' ? (
98113 < Checkbox
@@ -108,7 +123,7 @@ export const MenuItem = ({
108123 disabled = { disabled }
109124 role = "menuitemcheckbox"
110125 dataAttributes = { menuItemDataAttributes }
111- render = { ( { controlElement} ) => (
126+ render = { ( { controlElement, labelId } ) => (
112127 < Box paddingX = { 8 } paddingY = { 12 } >
113128 < Inline space = "between" alignItems = "center" >
114129 < div className = { styles . itemContent } >
@@ -117,9 +132,7 @@ export const MenuItem = ({
117132 < Icon size = { 24 } color = { contentColor } />
118133 </ div >
119134 ) }
120- < Text3 regular color = { contentColor } >
121- { label }
122- </ Text3 >
135+ { renderTextContent ( labelId ) }
123136 </ div >
124137 < Box paddingLeft = { 16 } > { controlElement } </ Box >
125138 </ Inline >
@@ -146,9 +159,7 @@ export const MenuItem = ({
146159 < Icon size = { 24 } color = { contentColor } />
147160 </ div >
148161 ) }
149- < Text3 regular color = { contentColor } >
150- { label }
151- </ Text3 >
162+ { renderTextContent ( ) }
152163 </ div >
153164 </ Box >
154165 </ Touchable >
0 commit comments