Breadcrumb element
When generating a breadcrumb an <ol>
element containing all necessary menu items is written to the output.
Element and builder
The BreadcrumbNavComponentBuilder
is provided to easily build breadcrumbs.
A builder can be created using BootstrapViewElements.bootstrap.builders.breadcrumb()
.
BreadcrumbNavComponentBuilder attributes
Attribute | Description | Default |
---|---|---|
|
Set the number of levels (breadcrumb segments) for which the icon will be rendered if there is one. |
By default all items will have their icons rendered. |
|
Set the number of levels (breadcrumb segments) that will be rendered as just the icon if NavComponentBuilder#ATTR_ICON_ONLY}` is |
By default all segments might be rendered this way. |
Breadcrumb items
The first step in building a breadcrumb is determining the menu items that will be used. When a menu item is disabled or filtered out, it will not be used to render the breadcrumb items. All menuItems that should be visible as breadcrumb items in the breadcrumb are build and the last item will be set active.
Attribute | Description | Default |
---|---|---|
|
When set a |
Not set by default |
|
If set to |
Not set by default |
For all the attributes consult the javadoc of NavComponentBuilder
.
Examples
Creating a simple breadcrumb navigation
Menu menu = new PathBasedMenuBuilder()
.item( "components", "Components" ).and()
.item( "components/breadcrumb", "Breadcrumb example" ).and().build();
menu.select( MenuSelector.byTitle( "Breadcrumb example" ) );
menu.setTitle( "Bootstrap UI Module" );
NodeViewElement breadcrumbNav = BootstrapViewElements.bootstrap.builders.breadcrumb().menu( menu ).build();
Creating a breadcrumb navigation with icons
Menu menu = new PathBasedMenuBuilder()
.item( "components", "Components" )
.attribute( NavComponentBuilder.ATTR_ICON, new GlyphIcon( GlyphIcon.HOME ) )
.attribute( NavComponentBuilder.ATTR_ICON_ONLY, true ).and()
.item( "components/breadcrumb", "Breadcrumb example" )
.attribute( NavComponentBuilder.ATTR_ICON, new GlyphIcon( GlyphIcon.HOURGLASS ) )
.and().build();
menu.select( MenuSelector.byTitle( "Breadcrumb example" ) );
menu.setTitle( "Bootstrap Ui Module" );
NodeViewElement breadcrumbNav = BootstrapViewElements.bootstrap.builders.breadcrumb().menu( menu ).build();