compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Context menu lacks some capabilities

Open adrientetar opened this issue 2 years ago • 6 comments

  • Right now, only the colors of DefaultContextMenuRepresentation can be customized. It would be nice to be able to customize the margins and text size etc. of both the menu and the menu items.

    • For the menu, it could take a modifier parameter applied to the Column inner composable.
    • For the menu item, perhaps ContextMenuItem should take a composable content lambda instead of a string label.
  • Right now, it's not possible to display an icon or a keyboard shortcut in the menu. It is spec'ed in Material Design context menus, though: image

  • Right now, it's not possible to add a divider to a context menu (and customize divider styling), see #1357

  • Right now, it's not possible to have a disabled menu item

  • Right now, it's not possible to add an item with a submenu

  • Styling:

    • Right now, the shadow looks larger/more diffuse than in the Material spec.
    • The menu item hover color is quite dark in light mode, I think it's a lighter color in the Material spec.
    • I think it would be nice to add more corner rounding, like in the Material 3 spec (it would match the current desktop UI trends better).

adrientetar avatar Mar 10 '23 17:03 adrientetar

Thanks, we'll discuss this with the team.

m-sasha avatar Mar 11 '23 13:03 m-sasha

@m-sasha have any update on the discussion?

adrientetar avatar Apr 21 '23 21:04 adrientetar

I apologize for taking a long time; we were busy with M1 and Kotlinconf. And now our team lead is on vacation, so unfortunately it'll take a little longer.

m-sasha avatar Apr 24 '23 16:04 m-sasha

Hi. So, these suggestions are good, but right now we're focusing on other issues for the desktop. We should, however, add material3 soon-ish, which should address some of the requests here. And of course, we will get to polishing our context menu APIs some time.

m-sasha avatar May 19 '23 06:05 m-sasha

In the meantime, I've put together a library that adds quite a bit of this missing functionality (icons, dividers, sub-menus, styling, etc): https://github.com/dzirbel/compose-material-context-menu. I hope this can cover most use cases until the team can dedicate time toward the builtin representation.

I also ran into a few limitations along the way, which I'll raise in a separate issue for discussion.

dzirbel avatar Aug 15 '23 05:08 dzirbel

a simple modifier in context menu and a composable function to ContextMenuItem would be awesome! It lacks customization and that rect shape looks terrible😅

PMARZV avatar May 19 '24 14:05 PMARZV

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Jul 14 '24 14:07 okushnikov