# Updated default text styles for menus

> The default text styles for menus are updated to match the Material 3 specification.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.
:::


## Summary

The default text styles used for menus are updated
to match the Material 3 specification.

## Context

The default text style for `MenuItemButton` (a widget used
in a `MenuBar`, and in a menu created with `MenuAnchor`),
and `DropdownMenuEntry` (in the `DropdownMenu`) is
updated to match the Material 3 specification.

Likewise, the default text style for the `DropdownMenu`s `TextField` is updated
to match the Material 3 specification.

## Description of change

The default text style for `MenuItemButton` (a widget used
in a `MenuBar`, and in a menu created with `MenuAnchor`),
and `DropdownMenuEntry` (in the `DropdownMenu`) is updated from
`TextTheme.bodyLarge` to `TextTheme.labelLarge` for Material 3.

The default text style for the `DropdownMenu`s `TextField` is updated from
`TextTheme.labelLarge` to `TextTheme.bodyLarge` for Material 3.

## Migration guide

A `MenuItemButton` for Material 3 uses
`TextTheme.labelLarge` as the default text style.
To use the previous default text style, set the `TextTheme.bodyLarge` text style
in the `MenuItemButton.style` or `MenuButtonThemeData.style` properties.

Code before migration:

```dart
MenuItemButton(
  child: Text(MenuEntry.about.label),
  onPressed: () => _activate(MenuEntry.about),
),
```

```dart
menuButtonTheme: MenuButtonThemeData(
  style: MenuItemButton.styleFrom(
    /// ...
  ),
),
```

Code after migration:

```dart
MenuItemButton(
  style: MenuItemButton.styleFrom(
    textStyle: Theme.of(context).textTheme.bodyLarge,
  ),
  child: Text(MenuEntry.about.label),
  onPressed: () => _activate(MenuEntry.about),
),
```

```dart
menuButtonTheme: MenuButtonThemeData(
  style: MenuItemButton.styleFrom(
    textStyle: Theme.of(context).textTheme.bodyLarge,
  ),
),
```

A `DropdownMenu`'s `TextField` for Material 3
uses `TextTheme.bodyLarge` as the default text style.
To use the previous default text style,
set the `TextTheme.labelLarge` text style in
the `DropdownMenu.textStyle` or `DropdownMenuThemeData.textStyle` properties.

Code before migration:

```dart
DropdownMenu<ColorLabel>(
  initialSelection: ColorLabel.green,
  controller: colorController,
  label: const Text('Color'),
  dropdownMenuEntries: colorEntries,
  onSelected: (ColorLabel? color) {
    setState(() {
      selectedColor = color;
    });
  },
),
```

```dart
dropdownMenuTheme: DropdownMenuThemeData(
  /// ...
),
```

Code after migration:

```dart
DropdownMenu<ColorLabel>(
  textStyle: Theme.of(context).textTheme.labelLarge,
  initialSelection: ColorLabel.green,
  controller: colorController,
  label: const Text('Color'),
  dropdownMenuEntries: colorEntries,
  onSelected: (ColorLabel? color) {
    setState(() {
      selectedColor = color;
    });
  },
),
```

```dart
dropdownMenuTheme: DropdownMenuThemeData(
  textStyle: TextStyle(
    fontStyle: FontStyle.italic,
    fontWeight: FontWeight.bold,
  ),
),
```

A `DropdownMenu`'s `DropdownMenuEntry` for Material 3
uses `TextTheme.labelLarge` as the default text style.
To use the previous default text style, set the
`TextTheme.bodyLarge` text style in
the `DropdownMenuEntry.style` or `MenuButtonThemeData.style` properties.

Code before migration:

```dart
DropdownMenuEntry<ColorLabel>(
  value: color,
  label: color.label,
),
```

```dart
menuButtonTheme: MenuButtonThemeData(
  style: MenuItemButton.styleFrom(
    /// ...
  ),
),
```

Code after migration:

```dart
DropdownMenuEntry<ColorLabel>(
  style: MenuItemButton.styleFrom(
    textStyle: Theme.of(context).textTheme.bodyLarge,
  ),
  value: color,
  label: color.label,
),
```

```dart
menuButtonTheme: MenuButtonThemeData(
  style: MenuItemButton.styleFrom(
    textStyle: Theme.of(context).textTheme.bodyLarge,
  ),
),
```

## Timeline

Landed in version: 3.14.0-11.0.pre<br>
In stable release: 3.16

## References

API documentation:

* [`MenuBar`][]
* [`MenuAnchor`][]
* [`MenuItemButton`][]
* [`MenuButtonTheme`][]
* [`DropdownMenu`][]
* [`DropdownMenuEntry`][]
* [`DropdownMenuTheme`][]
* [`TextTheme`][]

Relevant PRs:

* [Update default menu text styles for Material 3][]

[`MenuBar`]: https://api.flutter.dev/flutter/material/MenuBar-class.html
[`MenuAnchor`]: https://api.flutter.dev/flutter/material/MenuAnchor-class.html
[`MenuItemButton`]: https://api.flutter.dev/flutter/material/MenuItemButton-class.html
[`MenuButtonTheme`]: https://api.flutter.dev/flutter/material/MenuButtonTheme-class.html
[`DropdownMenu`]: https://api.flutter.dev/flutter/material/DropdownMenu-class.html
[`DropdownMenuEntry`]: https://api.flutter.dev/flutter/material/DropdownMenuEntry-class.html
[`DropdownMenuTheme`]: https://api.flutter.dev/flutter/material/DropdownMenuTheme-class.html
[`TextTheme`]: https://api.flutter.dev/flutter/material/TextTheme-class.html

[Update default menu text styles for Material 3]: https://github.com/flutter/flutter/pull/131930

