digdir / designsystemet

Designsystemet
https://designsystemet.no
MIT License
68 stars 34 forks source link

Padding-right issue on Switch #979

Closed ghost closed 8 months ago

ghost commented 8 months ago

Description of the bug

There is some padding on the right side of the Switch which prevents the component from being aligned in the center of my box:

image

Steps To Reproduce

  1. Use the Switch component inside a div
  2. Add a border to the div and make it the size of the switch

Additional Information

No response

Barsnes commented 8 months ago

Hello! Thanks for the bug report. It seems like this happens because the Switch uses css grid, with a gap, and the grid is hard coded to two columns in the css. So when you don't have any children or a description this happens. I will fix this issue, since this should not happen.

mimarz commented 8 months ago

Good morning! Just curious how have you solved the labeling the Switch in this use case? @WilliamThorenfeldt