Class NativeButton

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.NativeButton
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<NativeButton>, com.vaadin.flow.component.ClickNotifier<NativeButton>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<NativeButton>, com.vaadin.flow.component.FocusNotifier<NativeButton>, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, Serializable

@Tag("button") public class NativeButton extends com.vaadin.flow.component.HtmlContainer implements com.vaadin.flow.component.ClickNotifier<NativeButton>, com.vaadin.flow.component.Focusable<NativeButton>, com.vaadin.flow.component.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:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    What the button does when it is activated inside a NativeForm.

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.ClickNotifier

    com.vaadin.flow.component.ClickNotifier.ClickFiltersJs

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.Focusable

    com.vaadin.flow.component.Focusable.FocusJs

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

    com.vaadin.flow.component.HasText.WhiteSpace
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new empty button.
    NativeButton(com.vaadin.flow.signals.Signal<String> textSignal)
    Creates a button with its text content bound to the given signal.
    Creates a button with the given text.
    NativeButton(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<NativeButton>> clickListener)
    Creates a button with the given text and click listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets what the button does when it is activated inside a form.
    void
    setType(@Nullable NativeButton.Type type)
    Sets what the button does when it is activated inside a NativeForm.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttached

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasAriaLabel

    getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledBy, setAriaLabelledBy

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add

    Methods inherited from interface com.vaadin.flow.component.HasComponentsOfType

    add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll, replace

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasText

    bindText, getText, getWhiteSpace, setText, setWhiteSpace
  • 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(com.vaadin.flow.signals.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:
      • HasText.bindText(Signal)
    • NativeButton

      public NativeButton(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.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
    • 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
      See Also: