Skip to content

Commit aa9df91

Browse files
committed
Button width not working when style used inline vs sx
1 parent 6d8b7f4 commit aa9df91

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packages/react/src/Button/ButtonBase.module.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
/* IconButton */
7070

71-
&:where(.IconButton) {
71+
&.IconButton {
7272
display: inline-grid;
7373
width: var(--control-medium-size);
7474
min-width: unset;
@@ -78,12 +78,10 @@
7878

7979
&:where([data-size='small']) {
8080
width: var(--control-small-size);
81-
min-width: var(--control-small-size);
8281
}
8382

8483
&:where([data-size='large']) {
8584
width: var(--control-large-size);
86-
min-width: var(--control-large-size);
8785
}
8886
}
8987

packages/react/src/Button/IconButton.dev.stories.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {ChevronDownIcon} from '@primer/octicons-react'
1+
import {BoldIcon, ChevronDownIcon} from '@primer/octicons-react'
22
import React from 'react'
33
import {IconButton} from '.'
4+
import Box from '../Box'
45

56
export default {
67
title: 'Components/IconButton/DevOnly',
@@ -25,3 +26,15 @@ export const CustomSizeWithMedia = () => {
2526
export const CustomIconColor = () => (
2627
<IconButton aria-label="Expand" variant="invisible" size="small" icon={ChevronDownIcon} sx={{color: 'red'}} />
2728
)
29+
30+
export const CustomSizeWithStyleProp = () => (
31+
<Box sx={{border: '1px solid', borderColor: 'border.default', display: 'inline-block'}}>
32+
<IconButton
33+
icon={BoldIcon}
34+
aria-label="Bold"
35+
size="large"
36+
variant="invisible"
37+
style={{width: '20px', height: '28px'}}
38+
/>
39+
</Box>
40+
)

0 commit comments

Comments
 (0)