Skip to content

feat(menu): modernize Menu to Material Design 3 specs#5037

Open
matkoson wants to merge 10 commits into
callstack:mainfrom
matkoson:feat/modernize-menu
Open

feat(menu): modernize Menu to Material Design 3 specs#5037
matkoson wants to merge 10 commits into
callstack:mainfrom
matkoson:feat/modernize-menu

Conversation

@matkoson

Copy link
Copy Markdown
Contributor

Motivation

Modernize Menu / Menu.Item to the latest Material Design 3 specs. Reuse theme tokens (shape, typography, motion, color roles) and extract component tokens in the same pattern as Checkbox / FAB / ConnectedButtonGroup.

Spec re-check (M3 menus)

Re-checked M3 menus specs and overview:

  • Container shape corner.large; item first/last/selected corner.medium.
  • Label labelLarge; supporting bodySmall; trailing supporting labelLarge.
  • Default container fill is MD3 surfaceContainerLow. The elevation prop controls shadow only (Paper’s elevation.level2 maps to different surfaceContainer tones, so it is not used as the menu fill).
  • Selected items use tertiaryContainer / onTertiaryContainer.
  • Expressive choices: optional colorScheme="vibrant"; spring-animated item corner morph as focus/selection moves; optional badge and lightweight submenu portal surface; Menu.Section group gaps (8dp) in addition to Divider.

Changes

Tokens / Menu / Menu.Item

  • Container fill surfaceContainerLow; surface corner.large; first/last/selected item corner.medium via layout context (no cloneElement / no displayName filtering)
  • labelLarge, supporting + trailing supporting text, selected colors (disabled wins with content opacity)
  • Spring open/close via toRawSpring + reduce-motion snap
  • colorScheme standard | vibrant
  • Menu.Section group gaps; badge; lightweight submenu portal; Animated.spring per-corner radius morph on focus/selection

Example / docs / tests

  • Example: selection, supporting, vibrant, sections, badge, submenu
  • Docs + theme colors tables for selected/vibrant roles; refreshed Android + iOS screenshots
  • Unit tests for shape, colors, supporting text, dense, motion/reduce-motion, badge, submenu

Related issue

Fixes #4977

Test plan

  • yarn typecheck / yarn lint / Menu unit tests
  • Full unit test suite green
  • Android visual matrix (Pixel 9 Pro XL emulator)
  • iOS visual matrix (iPhone 16 Pro simulator)

Visual verification

Platform closed icons + disabled selected + supporting vibrant bottom anchor
Android (Pixel 9 Pro XL) a-closed a-icons a-sel a-vib a-bot
iOS (iPhone 16 Pro) i-closed i-icons i-sel i-vib i-bot

Docs screenshots: docs/public/screenshots/menu-*.png and menu-ios-*.png.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: modernize Menu to the latest Material Design specs

1 participant