mui / mui/material-ui

[TabPanel] add `disableGutters`

Open
#38,488 4 comments 3 reactions 1 assignee View on GitHub

@mnajdova is already working on this.

Since Aug 16, 2023.

package: lab scope: tabs
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡

Under my TabPanel's I display tables or lists, or some content that already includes padding.

It would be nice to be able to easily disable TabPanel padding with disableGutters property, like I can already do that on Toolbar or some other components.

Actually, so far, in 100% of the cases I wanted to remove the padding, so I would prefer disableGutters being true by default, but that would be a breaking change.

Workaround:

const myTheme = {
	components: {
		MuiTabPanel: {
			styleOverrides: {
				root: {
					paddingLeft: 0,
					paddingRight: 0
				}
			}
		}
	}
}
Examples 🌈
<TabContext value={tab}>
	<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
		<TabList onChange={(_, newValue: "charts" | "table") => setTab(newValue)}>
			<Tab label="Charts" value="charts" />
			<Tab label="Table" value="table" />
		</TabList>
	</Box>
	<TabPanel value="1">
		<Charts />
	</TabPanel>
	<TabPanel value="2" disableGutters>
		<Table />   ^^^^^^^^^^^^^^
	</TabPanel>
</TabContext>
Motivation 🔦
Screenshots with and without padding to illustrate how I would benefit from this feature

image

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.