Material UI v9.6.0 came out on 23 November 2026 with two features React teams building design systems will like. One is enhanceDensity, an experimental theme enhancer that puts most components on one shared spacing scale. The other gives you finer control over keyboard focus indicators with focusVisible.insetOverrides and theme.applyFocusVisible(). This tutorial shows how to use both, plus the gotchas from the docs.

Upgrade

npm install @mui/material@^9.6

The full changelog is in the v9.6.0 release notes. Besides the two features covered here, it includes many component fixes (Autocomplete, Slider, Popper, FocusTrap and others) and a new Uzbek (uz-UZ) locale.

Part 1: enhanceDensity

Why it exists

In a typical Material UI app, a medium Button, a TextField and a ToggleButton don’t quite share the same height, and padding comes from a mix of hard-coded pixels. According to the Enhance density docs, the enhancer “maps most components onto one shared spacing scale. Same-size controls end up on the same box, and one scale controls the whole set.”

It’s fully opt-in. Themes that don’t use it render exactly as before. It’s also marked unstable, so the API may change.

Basic setup

import {
  createTheme,
  unstable_enhanceDensity as enhanceDensity,
  ThemeProvider,
} from '@mui/material/styles';
import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import Stack from '@mui/material/Stack';

const theme = enhanceDensity(createTheme());

export default function App() {
  return (
    <ThemeProvider theme={theme}>
      <Stack direction="row" sx={{ gap: 'xSmall', p: 'medium' }}>
        <TextField size="small" label="Search" />
        <Button variant="contained">Go</Button>
      </Stack>
    </ThemeProvider>
  );
}

Notice gap: 'xSmall' and p: 'medium'. With the enhancer, theme.spacing(), and therefore sx, understands named steps.

The two sizing variables

You can tune two values:

  • touchTarget (default 32px): the height of a medium interactive control. Small controls are 28px and large ones 44px by default.
  • iconSize (default 16px): the size of a medium icon in SvgIcon and in the icons inside IconButton, Checkbox, Radio, Chip and the Select caret.
const theme = enhanceDensity(createTheme(), {
  touchTarget: 40,
  iconSize: 20,
});

Watch out: without the enhancer a medium icon is 24px, so with the default iconSize those icons shrink to 16px. Button start/end icons, Alert icons, StepIcon, the Pagination arrows and the Chip delete icon keep their own sizes.

For accessibility, small interactive components keep a touch area of at least 24×24px, the WCAG 2.2 minimum target size. Some grow to 24px, and others extend their hit area with a transparent ::before.

The spacing scale

Every component draws from seven fixed steps:

Step Value
xxSmall 4px
xSmall 8px
small 12px
medium 16px
large 24px
xLarge 32px
xxLarge 48px

These are absolute values, not multiples of theme.spacing. So small is 12px whatever your spacing unit is. A leading dash negates a step:

theme.spacing('small');   // '12px'
theme.spacing('-xSmall'); // '-8px'

Layout changes to expect

The enhancer also changes some layout behaviour:

  • Components such as Button switch from margin-based spacing between children to the CSS gap property.
  • FormControlLabel no longer adds its own margin. FormGroup spaces labels with gap, so add spacing yourself when labels sit outside a FormGroup.
  • Button and ToggleButton use theme.typography.button for every size. Without the enhancer, small and large sizes use 13px and 15px text.

Review forms and toolbars visually after switching.

Add your overrides before enhancing

The docs give one important warning. Put your styleOverrides in the theme you pass into enhanceDensity, and the enhancer keeps them as the last layer:

const theme = enhanceDensity(
  createTheme({
    components: {
      MuiCard: {
        styleOverrides: {
          root: ({ theme }) => ({ padding: theme.spacing('medium') }),
        },
      },
    },
  }),
);

If you add overrides afterwards with createTheme(enhancedTheme, { components: ... }), each overridden slot is replaced wholesale, and the density styles for that slot are silently lost. Also, calling enhanceDensity twice logs an error in development and returns the theme unchanged.

CSS variables and per-region density

With CSS theme variables, the steps ship as global CSS variables:

const theme = enhanceDensity(createTheme({ cssVariables: true }));
theme.spacing('small'); // 'var(--mui-spacing-small, 12px)'

That means you can make one area of the page denser with plain CSS:

.data-grid-toolbar {
  --mui-spacing-medium: 12px;
  --mui-touchTarget: 28px;
  --mui-iconSize: 14px;
}

This is often easier than a nested ThemeProvider. The docs warn that a nested provider with the same cssVarPrefix won’t apply its own scale.

TypeScript

To get touchTarget, iconSize and the step names in styled and sx callbacks, import the augmentation once:

import type {} from '@mui/material/themeDensityAugmentation';

Part 2: Better focus-visible control

Material UI added a built-in keyboard focus indicator in v9.4. You turn it on with createTheme({ focusVisible: true }). By default it’s a 2px solid outline in palette.primary.main, offset by 2px. Some components, such as Tab, draw it inside their edge so overflow-clipped containers don’t cut it off. Version 9.6 adds two tools for those inner indicators.

insetOverrides

insetOverrides takes CSS properties that the inner-indicator components merge over the rest of focusVisible:

const theme = createTheme({
  focusVisible: {
    outlineWidth: 2,
    outlineOffset: 1,
    boxShadow: '0 0 0 1px #fff',
    insetOverrides: {
      boxShadow: 'inset 0 0 0 3px #fff',
    },
  },
});

The focus visible docs explain why this is needed. These components set the whole indicator in their own focus selector, so a MuiButtonBase override doesn’t reach MenuItem, and a MuiIconButton override doesn’t reach the TablePagination buttons.

theme.applyFocusVisible()

When a component sits somewhere unusual, choose the indicator yourself. theme.applyFocusVisible('outset') returns the normal style, and 'inset' returns it with insetOverrides merged in:

const theme = createTheme({
  focusVisible: true,
  components: {
    MuiMenuItem: {
      styleOverrides: {
        root: ({ theme }) => ({
          '&.Mui-focusVisible': theme.applyFocusVisible('outset'),
        }),
      },
    },
  },
});

Call it on the theme as theme.applyFocusVisible(). The docs say a destructured method doesn’t work.

Accessibility tip from the docs

To replace the outline with a box-shadow, hide the outline with outlineColor: 'transparent', not outline: 'none'. In forced-colors mode the browser removes box-shadows and forces the outline to a system colour, so a transparent outline still shows up as the indicator. outline: 'none' would leave keyboard users with nothing.

Takeaway

Material UI 9.6 gives React teams a real density system. Use one scale and two sizing knobs, with CSS-variable overrides for dense regions, plus precise control over focus rings where the defaults fall short. Try enhanceDensity on a branch, check forms and icon sizes, and add your overrides before enhancing.