Toggle component that supports text inside the toggle #3288
mcullifer
started this conversation in
Ideas / feature requests
Replies: 1 comment
-
This will be in daisyUI 5 (coming soon)! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think it would be nice for the existing Toggle component to have a variant that allows text inside the switch. The circle inside the toggle would be the width of the text. Toggling would transition its position to the other side and transition its width. Basically a similar little animation that the current Toggle component already has. Not sure how complicated this is to implement but it seems like it could be done with a similar structure to the Swap component? I guess with the different toggle types (toggle-primary, toggle-secondary, etc.) the
toggle-on
andtoggle-off
classes would have to applytext-primary-content
,text-secondary-content
, etc accordingly.This medium article has a pretty good example and gets the idea across. Could be more refined though like having
select-none
/user-select: none;
seems pretty sensible because it's kinda gross accidentally double clicking that and it ends up highlighting the text.Another example is the toggle switch uber eats has
Let me know if this is already possible because I'd love to have something like this in a project I'm using DaisyUI for!
Beta Was this translation helpful? Give feedback.
All reactions