@@ -167,11 +167,32 @@ export const MenuLabel = React.forwardRef<HTMLSpanElement, MenuLabelProps>(funct
167167 } ) ;
168168} ) ;
169169
170+ /** `span`, not `div`: the item this sits in is a button, so its children are phrasing content. */
171+ export type MenuIndicatorProps = MosaicComponentProps < 'span' > ;
172+
173+ /**
174+ * Square trailing column for a mark at the end of the row (a check, a spinner). It keeps its width
175+ * while empty, so a mark that appears later does not shift the label.
176+ */
177+ export const MenuIndicator = React . forwardRef < HTMLSpanElement , MenuIndicatorProps > ( function MosaicMenuIndicator (
178+ { render, xstyle, ...rest } ,
179+ ref ,
180+ ) {
181+ return useRender ( {
182+ defaultTagName : 'span' ,
183+ render,
184+ ref,
185+ props : {
186+ ...mergeStyleProps ( themeProps ( 'menu-indicator' ) , stylex . props ( reset . base , slots . indicator . base , xstyle ) , rest ) ,
187+ } ,
188+ } ) ;
189+ } ) ;
190+
170191export interface MenuItemProps extends Omit < PrimitiveMenuItemProps , 'className' | 'style' > , MosaicStyleProps {
171192 /** Semantic color of the action. */
172193 color ?: 'neutral' | 'negative' ;
173194 /**
174- * The row's content, composed from `Menu.Media` and `Menu.Label `. Required, and text goes in
195+ * The row's content, composed from `Menu.Media`, `Menu.Label` and `Menu.Indicator `. Required, and text goes in
175196 * `Menu.Label` rather than straight in here: a bare text node is not a flex item the row can
176197 * size, so it neither lines up with the other rows nor truncates.
177198 */
@@ -227,5 +248,6 @@ export const Menu = {
227248 Item : MenuItem ,
228249 Media : MenuMedia ,
229250 Label : MenuLabel ,
251+ Indicator : MenuIndicator ,
230252 Separator : MenuSeparator ,
231253} ;
0 commit comments