1. Domino UI
  2. Components
  3. Alerts
Top Simple Addons Body Docs

Navigation bar

The NavBar class represents a navigation bar UI component that typically contains a title, description, and a body.

Usage Example:

 
 // Create a NavBar with a title
 NavBar navBar = NavBar.create("My Navigation Bar");

 // Set a description for the NavBar
 navBar.setDescription("This is a sample navigation bar.");

 // Customize the title element
 navBar.withTitle((nav, titleElement) -> {
     titleElement.addCss("custom-title");
     titleElement.setTextContent("Custom Title");
 });

 // Customize the body element
 navBar.withBody((nav, bodyElement) -> {
     bodyElement.addCss("custom-body");
     bodyElement.appendChild(TextNode.of("Custom Body Content"));
 });
 

See also :

Anatomy

navbar-anatomy.
  1. navigation prefix addons.
  2. Navigation bar title.
  3. Navigation bar body.
  4. Navigation bar postfix addons.

Examples

Simple navigation bar Simple content header with title and optional description

Navigation bar addons Navigation bar can have optional prefix and postfix addons.

Navigation bar body Navigation bar can have other components added to its main body

API Docs: NavBar

Constructors

public void NavBar()
Creates a new NavBar instance with default settings.
public void NavBar(Node title)
Creates a new NavBar instance with the specified title.

title

The title to display in the navigation bar.

public void NavBar(String title, String description)
Constructs a NavBar with the specified title and description.

title

The title to be displayed in the navigation bar.

description

The description to be displayed in the navigation bar.

Static methods

public static NavBar create()
Creates a new NavBar instance with default settings.

Returns:

A new NavBar instance.

public static NavBar create(String title)
Creates a new NavBar instance with the specified title.

title

The title to display in the navigation bar.



Returns:

A new NavBar instance with the specified title.

public static NavBar create(Node title)
Creates a new NavBar instance with the specified title.

title

The title to display in the navigation bar.



Returns:

A new NavBar instance with the specified title.

Public methods

public NavBar setTitle(String title)
Sets the title to display in the navigation bar.

title

The title to set.



Returns:

This NavBar instance.

public NavBar setTitle(Node title)
Sets the title to display in the navigation bar.

title

The title to set.



Returns:

This NavBar instance.

public NavBar setDescription(String description)
Sets the description to display in the navigation bar.

description

The description to set.



Returns:

This NavBar instance.

public NavBar withTitle(ChildHandler<NavBar, HeadingElement> handler)
Allows customization of the title element.

handler

The handler for customizing the title element.



Returns:

This NavBar instance.

public NavBar withDescription(ChildHandler<NavBar, SmallElement> handler)
Allows customization of the description element.

handler

The handler for customizing the description element.



Returns:

This NavBar instance.

public NavBar withTitleTextElement(ChildHandler<NavBar, SpanElement> handler)
Allows customization of the title text element.

handler

The handler for customizing the title text element.



Returns:

This NavBar instance.

public HeadingElement getTitleElement()
Gets the title element.

Returns:

The title element.

public SmallElement getDescriptionElement()
Gets the description element.

Returns:

The description element.

public String getTitle()
Gets the text of the title displayed in the navigation bar.

Returns:

The title text.

public SpanElement getTitleTextElement()


Returns:

the element containing the text of the title.

public String getDescription()
Gets the text of the description displayed in the navigation bar.

Returns:

The description text.

public NavBar withBody(ChildHandler<NavBar, DivElement> handler)
Allows customization of the body element.

handler

The handler for customizing the body element.



Returns:

This NavBar instance.

public DivElement getBody()
Gets the body element.

Returns:

The body element.

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

Donate & Support Us