1. Domino UI
  2. Components
  3. Buttons
Top Basic Sizes Groups Drop down Docs

Buttons

Base button

A base component to implement buttons

this class provides commons functionality and methods used in different implementations of a button

B

The button subclass being wrapped

Button

a simple button component

this class provide a set of factory methods to create simple buttons with different styles and a combination of a text and icon.

LinkButton

DropDownButton

A Button with dropdown menu component

By default this Button component will open a dropdown menu when clicked

See also :

ButtonsToolbar

a component for a toolbar that has many buttons

This class is used to group buttons in a set of sub-groups to form a toolbar

See also :

ButtonsGroup

a component to group a set of buttons and align them horizontally or vertically, by default buttons will be aligned horizontally.

See also :

Examples

Basic buttons Basic buttons with different styles, text and icons.

Button sizes Buttons can have different predefined sizes.

Buttons groups Buttons can be grouped together.

Dropdown and Split buttons Buttons can have dropdown menu or a split dropdown button.

API Docs: BaseButton

Public methods

public B setTextContent(String text)
Update the button text

Returns:

an instance of B implementation extending from BaseButton

public B setText(String text)
Update the button text

Returns:

an instance of B implementation extending from BaseButton

public HTMLElement getClickableElement()
Check super implementation documentation.

Returns:

the element that will receive click events when click listeners ar added to this component

public B circle()
changes the button to a circle button by applying dui_circle css style

Returns:

same Button instance.

public B setIcon(Icon<?> icon)
sets the button icon replacing the current icon.

icon

the new Icon



Returns:

same instance

public SpanElement getTextElement()
This will automatically initialize the button text element and append to the button if it was not initialized yet.

Returns:

a SpanElement that holds the button text.

public B withTextElement(ChildHandler<B, SpanElement> handler)
Use this to apply customizations to the button text element without breaking the fluent API chain this will initialize the text element and append it to the button if it was not yet initialized.

handler

a ChildHandler to apply the customization



Returns:

same button instance

public B withTextElement()
This will initialize the text element and append it to the button if it was not yet initialized.

Returns:

same button instance

public B withIconElement(ChildHandler<B, Icon<?>> handler)
Use this to apply customizations to the button icon element without breaking the fluent API chain this will initialize the icon element and append it to the button if it was not yet initialized.

handler

a ChildHandler to apply the customization



Returns:

same button instance

public B withIconElement()
This will initialize the icon element and append it to the button if it was not yet initialized.

Returns:

same button instance

public B withBodyElement(ChildHandler<B, DivElement> handler)
Use this to apply customizations to the button body element without breaking the fluent API chain

handler

a ChildHandler to apply the customization



Returns:

same button instance

public B setReversed(boolean reversed)
Reverse the order of the button icon and text

reversed

true to order text to the left and icon to the right, false icon to the right and text to the left



Returns:

same button instance

API Docs: Button

Constructors

public void Button()
Creates an empty button
public void Button(String text)
create a Button with a text.

text

String, the button text

public void Button(Icon<?> icon)
Creates a Button with an icon

icon

The button icon

public void Button(String text, Icon<?> icon)
Creates button with text and icon

text

The button text

icon

The button icon

Static methods

public static Button create()
Factory method to create empty button

Returns:

new Button instance

public static Button create(String text)
Factory method to create a button with a text.

text

The button text



Returns:

new Button instance

public static Button create(Icon<?> icon)
Factory method to create a button with an icon.

icon

the button icon



Returns:

new Button instance

public static Button create(String text, Icon<?> icon)
Factory method to create button with a text and icon.

text

a String object

icon

the button icon



Returns:

new Button instance

public static Button create(Icon<?> icon, String text)
Factory method to create button with a text and icon.

icon

the button icon

text

a String object



Returns:

new Button instance

API Docs: LinkButton

API Docs: DropdownButton

Constructors

public void DropdownButton(T button, Menu<V> menu)
Creates a DropdownButton from a button and a menu

button

The button to be used as dropdown menu target

menu

The Menu to be used as a dropdown menu

Static methods

public static DropdownButton<T, V> create(T button, Menu<V> menu)
Factory method to create a DropdownButton button from the provided button and menu

button

The button to be used as dropdown menu target

menu

The Menu to be used as a dropdown menu

T

a T class

V

a V class



Returns:

new DropdownButton instance

Public methods

public T getButton()


Returns:

The button component of this DropdownButton instance.

public Menu<V> getMenu()


Returns:

The menu component of this DropdownButton instance

public DropdownButton<T, V> withButton(ChildHandler<DropdownButton<T, V>, T> handler)
Use to apply customization to the button component of this DropdownButton instance without breaking the fluent API chain. ChildHandler

handler

a ChildHandler that applies the customization.



Returns:

same DropdownButton instance

public DropdownButton<T, V> withMenu(ChildHandler<DropdownButton<T, V>, Menu<V>> handler)
Use to apply customization to the menu component of this DropdownButton instance without breaking the fluent API chain. ChildHandler

handler

a ChildHandler that applies the customization.



Returns:

same DropdownButton instance

API Docs: ButtonsToolbar

Constructors

public void ButtonsToolbar()
Creates and empty ButtonsToolbar

Static methods

public static ButtonsToolbar create()
Factory method to create an empty ButtonsToolbar.

Returns:

a new ButtonsToolbar instance

Public methods

public ButtonsToolbar appendChild(ButtonsGroup group)
Adds a ButtonsGroup to the toolbar

group

ButtonsGroup



Returns:

same ButtonsToolbar instance

public ButtonsToolbar appendChild(ButtonsGroup[] groups)
Adds provided ButtonsGroups to the toolbar

groups

ButtonsGroup



Returns:

same ButtonsToolbar instance

public ButtonsToolbar appendChild(IsButton[] buttons)
Adds provided buttons to the toolbar

buttons

IsButton



Returns:

same ButtonsToolbar instance

API Docs: ButtonsGroup

Constructors

public void ButtonsGroup()
Creates an empty ButtonsGroup
public void ButtonsGroup(IsButton[] buttons)
Creates a ButtonsGroup that holds the provided buttons

buttons

The set of IsButton components to be appended to the ButtonsGroup

Static methods

public static ButtonsGroup create()
Factory method to create an empty ButtonsGroup

Returns:

An empty ButtonsGroup .

public static ButtonsGroup create(IsButton[] buttons)
Factory method to create a ButtonsGroup that holds the provided buttons

buttons

The set of IsButton components to be appended to the ButtonsGroup



Returns:

A ButtonsGroup

We are a group of passionate people who love what we do

Donate & Support Us