@Tag(value="vaadin-button") @NpmPackage(value="@vaadin/vaadin-button", version="2.4.0") @JsModule(value="@vaadin/vaadin-button/src/vaadin-button.js") @HtmlImport(value="frontend://bower_components/vaadin-button/src/vaadin-button.html") public abstract class GeneratedVaadinButton<R extends GeneratedVaadinButton<R>> extends Component implements HasStyle, ClickNotifier<R>, HasText, Focusable<R>, HasTheme
Description copied from corresponding location in WebComponent:
<vaadin-button>
is a Web Component providing an accessible and
customizable button.
<vaadin-button> </vaadin-button>
document.querySelector('vaadin-button').addEventListener('click', () => alert('Hello World!'));
The following shadow DOM parts are exposed for styling:
Part name | Description |
---|---|
label |
The label (text) inside the button |
prefix |
A slot for e.g. an icon before the label |
suffix |
A slot for e.g. an icon after the label |
The following attributes are exposed for styling:
Attribute | Description |
---|---|
active |
Set when the button is pressed down, either with mouse, touch or the keyboard. |
disabled |
Set when the button is disabled. |
focus-ring |
Set when the button is focused using the keyboard. |
focused |
Set when the button is focused. |
BlurNotifier.BlurEvent<C extends Component>
FocusNotifier.FocusEvent<C extends Component>
Constructor and Description |
---|
GeneratedVaadinButton()
Default constructor.
|
GeneratedVaadinButton(String text)
Sets the given string as the content of this component.
|
Modifier and Type | Method and Description |
---|---|
void |
addThemeVariants(ButtonVariant... variants)
Adds theme variants to the component.
|
protected void |
addToPrefix(Component... components)
Adds the given components as children of this component at the slot
'prefix'.
|
protected void |
addToSuffix(Component... components)
Adds the given components as children of this component at the slot
'suffix'.
|
protected boolean |
isAutofocusBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isDisabledBoolean()
Description copied from corresponding location in WebComponent:
|
protected void |
remove(Component... components)
Removes the given child components from this component.
|
protected void |
removeAll()
Removes all contents from this component, this includes child components,
text content as well as child elements that have been added directly to
this component using the
Element API. |
void |
removeThemeVariants(ButtonVariant... variants)
Removes theme variants from the component.
|
protected void |
setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
|
protected void |
setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addClickListener, addClickShortcut
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
addBlurListener
addFocusListener
isEnabled, setEnabled
getElement
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
addAttachListener
addDetachListener
public GeneratedVaadinButton(String text)
text
- the text content to setHasText.setText(String)
public GeneratedVaadinButton()
public void addThemeVariants(ButtonVariant... variants)
variants
- theme variants to addpublic void removeThemeVariants(ButtonVariant... variants)
variants
- theme variants to removeprotected boolean isAutofocusBoolean()
Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
autofocus
property from the webcomponentprotected void setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
autofocus
- the boolean value to setprotected boolean isDisabledBoolean()
Description copied from corresponding location in WebComponent:
If true, the user cannot interact with this element.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
disabled
property from the webcomponentprotected void setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:
If true, the user cannot interact with this element.
disabled
- the boolean value to setprotected void addToPrefix(Component... components)
components
- The components to add.protected void addToSuffix(Component... components)
components
- The components to add.protected void remove(Component... components)
components
- The components to remove.IllegalArgumentException
- if any of the components is not a child of this component.protected void removeAll()
Element
API.Copyright © 2023. All rights reserved.