@@ -8,6 +8,7 @@ import {Divider} from './ActionList/Divider'
8
8
import { ActionListContainerContext } from './ActionList/ActionListContainerContext'
9
9
import { Button , ButtonProps } from './Button'
10
10
import { MandateProps } from './utils/types'
11
+ import { SxProp , merge } from './sx'
11
12
12
13
type MenuContextProps = Pick <
13
14
AnchoredOverlayProps ,
@@ -73,13 +74,26 @@ const Anchor = React.forwardRef<AnchoredOverlayProps['anchorRef'], ActionMenuAnc
73
74
74
75
/** this component is syntactical sugar 🍭 */
75
76
export type ActionMenuButtonProps = ButtonProps
76
- const MenuButton = React . forwardRef < AnchoredOverlayProps [ 'anchorRef' ] , ButtonProps > ( ( props , anchorRef ) => {
77
- return (
78
- < Anchor ref = { anchorRef } >
79
- < Button trailingIcon = { TriangleDownIcon } type = "button" { ...props } />
80
- </ Anchor >
81
- )
82
- } )
77
+ const MenuButton = React . forwardRef < AnchoredOverlayProps [ 'anchorRef' ] , ButtonProps > (
78
+ ( { sx : sxProp = { } , ...props } , anchorRef ) => {
79
+ return (
80
+ < Anchor ref = { anchorRef } >
81
+ < Button
82
+ type = "button"
83
+ trailingIcon = { TriangleDownIcon }
84
+ sx = { merge (
85
+ {
86
+ // override the margin on caret for optical alignment
87
+ '[data-component=trailingIcon]' : { marginX : - 1 }
88
+ } ,
89
+ sxProp as SxProp
90
+ ) }
91
+ { ...props }
92
+ />
93
+ </ Anchor >
94
+ )
95
+ }
96
+ )
83
97
84
98
type MenuOverlayProps = Partial < OverlayProps > &
85
99
Pick < AnchoredOverlayProps , 'align' > & {
0 commit comments