ButtonViewElement

A ButtonViewElement writes a <button> element to the output.

Element and builder

The ButtonViewElement has an equivalent ButtonViewElementBuilder. A builder can be created using BootstrapViewElements.bootstrap.builders.button() factory methods.

ButtonViewElement attributes

Attribute Description Default

Type

A ButtonViewElement can have the following type: BUTTON, BUTTON_SUBMIT, BUTTON_RESET, INPUT, INPUT_SUBMIT, INPUT_RESET,LINK

BUTTON

State

A ButtonViewElement can have the following states: ACTIVE, DISABLED

ACTIVE

Icon

An icon can be provided to show on the button. It can be aligned left, right or set as iconOnly.

Not set by default

Link

Transform the ButtonViewElement into a link.

Not set by default

Examples

Creating a simple button

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders
    .button()
    .text( "Click me" )
    .build();
import static com.foreach.across.modules.bootstrapui.styles.BootstrapStyles.css;
import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;
import static com.foreach.across.modules.web.ui.elements.HtmlViewElements.html;

bootstrap.builders
    .button()
    .text( "To google  " )
    .link( "http://www.foreach.be" )
    .iconRight()
    .icon( IconSet.iconSet( FONT_AWESOME_SOLID_ICON_SET ).icon( "download" ) )
    .build();

Large submit button

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders
    .button()
    .submit()
    .size(Size.LARGE )
    .text( "Submit" )
    .build();