Scott Kruse

04/28/2023, 8:47 PM
What’s the best way to override ButtonDefaults.MinSize to render a smaller Material 3 Button composable? I want to scale the button size according to the Text content + a bit of contentPadding similar to how wrap_content behaves in view system.
I can create a custom Surface that mirrors the material button source but there’s a bunch of internal classes and functions that I’d probably have to fork or recreate as well?

mohamed rejeb

04/29/2023, 4:01 AM
You can create a custom Button that mirrors the material button, you need to copy the ButtonDefaults and all of this stuffs, but you can also create a simple button using Box with clickable Modifier if that fits your needs.
I encountered this issue with compose desktop, material buttons are too big for desktop so I created my own Button composables.