Is the current hover behavior of the default button variant (nova/lyra styling) intended. #10419
jimmyorpheus
started this conversation in
General
Replies: 1 comment 1 reply
-
|
doesn’t look intentional more like a side effect of the Right now, I’d suggest removing
Keeps behavior consistent and predictable across button and asChild. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is the current hover behavior of the default button variant (nova/lyra styling) intended?
The current tailwindcss definition is restricted by an arbitrary variant
[a]..."default: ... [a]:hover:bg-primary/80"...and compiles to the following css definition...
...meaning that the
bg-primary/80hover style is only applied to<a>-tag elements.Since the
asChild-prop of the Button component is set tofalseby default, the Button component will render as a native html button...const Comp = asChild ? Slot.Root : 'button';...meaning that the hover style is not applied by default. It is only applied if your Button passes a
trueasChild-prop and wraps an<a>-tag child element, as it might be derived from a next/link component.This described hover behavior could be intentional, e.g. to reduce the visual distraction that would be caused by the hover effect. But then, what about the hover effects that are still caused by the other button variants?
e.g.
outline: "... hover:bg-muted ... dark:hover:bg-input/50",And as mentioned, even the default variant applies the hovering effect in such cases, where an
<a>-tag is passed as child - when the button is used for routing. Furthermore, since buttons use the default cursor by default there remains no visual indication that a default button variant with a default setting ofasChild=falseis a clickable element, except it's shape perhaps.Therefore my question: Is the current hover behavior, that the hover style is not applied by default, intended? Or would it be fine to have the arbitrary selector
[a]removed:default: "... hover:bg-primary/80"I understand that all the styling is anyway adjustable and meant to be customized. This is why I am only asking about the out-of-the-box defaults as the come with Nova or Lyra styling selected.
Beta Was this translation helpful? Give feedback.
All reactions