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 BootstrapUiBuilders.button()
factory methods.
ButtonViewElement attributes
Attribute | Description | Default |
---|---|---|
|
A |
BUTTON |
|
A |
ACTIVE |
|
A |
Not set by default |
|
Transform the |
Not set by default |
Examples
Creating a simple button
Given the following builder configuration
BootstrapUiBuilders
.button()
.text( "Click me" )
.build();
The following markup would be rendered:
<button type="button" class="btn btn-default">Click me</button>
Button as link with icon
Given the following builder configuration
BootstrapUiBuilders
.button()
.text( "To google " )
.link( "http://www.foreach.be" )
.iconRight()
.icon( BootstrapUiBuilders.glyphIcon( GlyphIcon.ARROW_RIGHT ))
.build();
The following markup would be rendered:
<a role="button" href="http://www.foreach.be" class="btn btn-link">To google <span aria-hidden="true" class="glyphicon glyphicon-arrow-right"></span></a>