Skip to content

bug: Padding in toggles is not dependent on size, leading to inconsistencies #3746

@Acccent

Description

@Acccent

Reproduction URL (Required)

https://play.tailwindcss.com/kp9hHDDfAy

What version of daisyUI are you using?

5.0.0

Which browsers are you seeing the problem on?

All browsers

Describe your issue

The padding inside the toggle element (used to create space between the "outside border" and the "inner toggle" itself) is set as an absolute value.

This can lead to inconsistent appearances, if the --size-selector variable or the root font-size is changed. See repro link.

An easy fix would be to make the padding dependent on the --size variable that's already calculated for each toggle element:

- --toggle-p: 0.1875rem;
   --size: calc(var(--size-selector, 0.25rem) * 6);
+ --toggle-p: calc(var(--size)*0.125);

Additionally this change would make the padding automatically work for all size variations of the toggle, removing the need to specify it 6 times.

I can submit a PR if it helps.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions