Hi how to change Checkbox rounded corner for Box, ...
# compose
m
Hi how to change Checkbox rounded corner for Box, after check the code i think it is impossible. Radius should be changeable from the outside
Copy code
@Composable
private fun CheckboxImpl(
    enabled: Boolean,
    value: ToggleableState,
    modifier: Modifier,
    colors: CheckboxColors
) {
....
        drawBox(
            boxColor = boxColor,
            borderColor = borderColor,
            radius = RadiusSize.toPx(),
            strokeWidth = strokeWidthPx
        )
1
k
Not everything in Material components is configurable like that. This is a snippet from the material checkbox implementation that follows that specific design language. You can copy specific bits over to your codebase and make it as configurable as your own design language needs to be.
3
m
hmm i think change corner radius should be a standard, of course i can copy it and change it. But i think that i will be not only that want to change it. Also other composable have this option, that's why i was surprised that i can't change it
But thanks for your response 🙂
c
In the Material Design system, changing corner radius on specific components is done via Shape theming / shape parameter. Checkboxes do not use Shape theming so the corner radius is set. As Kirill mentioned above, if you’d like a different look for it, you’ll have to create your own.
I will certainly pass your feedback along to the Material Design team that checkboxes should be shape themeable
👍 2
k
Not sure if checkboxes or radio buttons should be shapeable, at least at the Material level. There's a rather strong existing visual reference of how a checkbox is "supposed" to look like vs a radiobutton,
1
m
Thanks and of course, all you are doing great work. :)
🙏 1
l
I think checkboxes should be shape themable. I see people making them round (like in Apple Notes), square (like on Windows I think), and maybe some other shapes, though not sure which.
c
Sure, but those are distinct styles for that platform. I think Material wants to keep the style of this common control consistent in Android so probably why it’s not shape themeable. Like on iOS, the checkbox in Notes and Reminders are both round circles. And in Windows it’s square on Windows apps. Which I think is intentional as the platform guidance.
Now I know designers tend to make iOS designs first/only which doesn’t help, but that’s a different convo)
609 Views