Class NativeButton

All Implemented Interfaces:
AttachNotifier, BlurNotifier<NativeButton>, ClickNotifier<NativeButton>, DetachNotifier, Focusable<NativeButton>, FocusNotifier<NativeButton>, HasAriaLabel, HasComponents, HasComponentsOfType<Component>, HasElement, HasEnabled, HasSize, HasStyle, HasText, Serializable

@Tag("button") public class NativeButton extends HtmlContainer implements ClickNotifier<NativeButton>, Focusable<NativeButton>, HasAriaLabel
Component representing a <button> element.

A clickable control that submits a form, resets it, or runs an action.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • NativeButton

      public NativeButton()
      Creates a new empty button.
    • NativeButton

      public NativeButton(String text)
      Creates a button with the given text.
      Parameters:
      text - the button text
    • NativeButton

      public NativeButton(Signal<String> textSignal)
      Creates a button with its text content bound to the given signal.
      Parameters:
      textSignal - the signal to bind, not null
      Since:
      25.1
      See Also:
    • NativeButton

      public NativeButton(String text, ComponentEventListener<ClickEvent<NativeButton>> clickListener)
      Creates a button with the given text and click listener.
      Parameters:
      text - the button text
      clickListener - the click listener
  • Method Details

    • setType

      public void setType(@Nullable NativeButton.Type type)
      Sets what the button does when it is activated inside a NativeForm. A button without a type submits the form, so set NativeButton.Type.BUTTON on a button in a form that should only run its click listeners.
      Parameters:
      type - the type, or null to remove the attribute
      Since:
      25.4
    • getType

      public @Nullable NativeButton.Type getType()
      Gets what the button does when it is activated inside a form.
      Returns:
      the type, or null if not set or not recognized
      Since:
      25.4
      See Also: