Tooltip for Element

Button button = ...; button.setTooltipText("tooltip text");

If it’s only for the label inside of a button, not the rest of the button, you’d probably add the label as a Span inside the button.

And the public API you’re looking for is Tooltip.forComponent(somecomponent);

(I can’t imagine why you’d want that to be honest, but it’s certainly doable)

Out of curiosity, why do you want to do it like that?

I think this should work:

        Span span = new Span("Label");
        Button button = new Button();
        button.getElement().appendChild(span.getElement());

yeah I would definitely not use Buttons as dashboard cards…

but if you must, this should do it:

Span sp = new Span();
Tooltip.forComponent(sp);
        ...
Button btn = new Button();
        btn.getElement().appendChild(sp.getElement());