Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions packages/mui-material/src/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,6 @@ const ButtonRoot = styled(ButtonBase, {
color: (theme.vars || theme).palette.action.disabled,
},
variants: [
{
props: ({ ownerState }) =>
ownerState.startIcon || (ownerState.loading && ownerState.loadingPosition === 'start'),
style: {
'&::before': {
content: '"\\200b"',
width: 0,
overflow: 'hidden',
},
},
},
{
props: { variant: 'contained' },
style: {
Expand Down Expand Up @@ -345,8 +334,14 @@ const ButtonStartIcon = styled('span', {
},
})(({ theme }) => ({
display: 'inherit',
alignItems: 'center',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary?

Copy link
Copy Markdown
Member

@ZeeshanTamboli ZeeshanTamboli May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is because the ::before content is inside the Icon <span> container, so it would be a flex item.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep it's to keep the icon centered

marginRight: 8,
marginLeft: -4,
'&::before': {
content: '"\\200b"',
width: 0,
overflow: 'hidden',
},
variants: [
{
props: { size: 'small' },
Expand Down
17 changes: 17 additions & 0 deletions test/regressions/fixtures/Button/StartIconGapButtons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from 'react';
import AddBoxIcon from '@mui/icons-material/AddBox';
import Button from '@mui/material/Button';
import Stack from '@mui/material/Stack';

export default function StartIconGapButtons() {
return (
<Stack spacing={2} sx={{ alignItems: 'flex-start' }}>
<Button variant="outlined" startIcon={<AddBoxIcon />}>
Default gap
</Button>
<Button variant="outlined" startIcon={<AddBoxIcon />} sx={{ gap: '20px' }}>
Custom gap
</Button>
</Stack>
);
}
Loading