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 :
public void NavBar()
NavBar instance with default settings.
public void NavBar(Node title)
NavBar instance with the specified title.
title
The title to display in the navigation bar.
public void NavBar(String title, String description)
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.
public static NavBar create()
NavBar instance with default settings.
A new NavBar instance.
public static NavBar create(String title)
NavBar instance with the specified title.
title
The title to display in the navigation bar.
A new NavBar instance with the specified title.
public static NavBar create(Node title)
NavBar instance with the specified title.
title
The title to display in the navigation bar.
A new NavBar instance with the specified title.
public NavBar setTitle(String title)
title
The title to set.
This NavBar instance.
public NavBar setTitle(Node title)
title
The title to set.
This NavBar instance.
public NavBar setDescription(String description)
description
The description to set.
This NavBar instance.
public NavBar withTitle(ChildHandler<NavBar, HeadingElement> handler)
handler
The handler for customizing the title element.
This NavBar instance.
public NavBar withDescription(ChildHandler<NavBar, SmallElement> handler)
handler
The handler for customizing the description element.
This NavBar instance.
public NavBar withTitleTextElement(ChildHandler<NavBar, SpanElement> handler)
handler
The handler for customizing the title text element.
This NavBar instance.
public HeadingElement getTitleElement()
The title element.
public SmallElement getDescriptionElement()
The description element.
public String getTitle()
The title text.
public SpanElement getTitleTextElement()
the element containing the text of the title.
public String getDescription()
The description text.
public NavBar withBody(ChildHandler<NavBar, DivElement> handler)
handler
The handler for customizing the body element.
This NavBar instance.
public DivElement getBody()
The body element.