Search code examples
vaadinvaadin14

Vaadin 14 - Disable Hovering Response on Buttons


Is it possible to disable the hovering functionality for Buttons? I haven't come across any methods that facilitate this, so I'm guessing writing a custom function might be required here.


Solution

  • You can change the hover with CSS.

    Add CSS file with this content. opacity: 0 will disable the change on hover.

    :host(:hover)::before {
        opacity: 0;
    }
    

    Then you have to import it for the vaadin-button like this:

    @CssImport(value = "./themes/vaadindemo/components/button.css", themeFor = "vaadin-button")
    

    Please find a running example here:

    https://github.com/simasch/vaadin-examples