1. Domino UI
  2. Components
  3. Badges
Top Buttons Icons Lists Docs

Badges

Displays a label that fits within other components and elements.

The component will auto-fit within other elements and will float to the right by default, and will show at the top right if appended to icons.

Example:

 
     Badge.create("label")
 

See also :

Examples

Badges in buttons Badges can go inside other components like buttons.

Badges with icons Badges will auto fit when added to icons.

Badges in lists Badges can fit in other components like lists, trees and Nav bars

API Docs: Badge

Constructors

public void Badge()
Creates an empty badge instance.

Static methods

public static Badge create(String content)
factory method to create a badge with a text content

content

the text to be added to the badge



Returns:

new badge instance

Public methods

public Badge setRemovable(boolean removable)
Sets the badge as removable or not, removable badges will have a close button, clicking the close button will remove the badge from the dom.

removable

true to set it as removable and show the close button, false the badge is not removable and close button will be removed.



Returns:

Same badge instance

public Badge removable()
Shortcut method for setRemovable(true) Sets the alert to closable and a close button will be added.

Returns:

Same badge instance

public Badge unRemovable()
Sets the alert to not closable and the close button will be removed if exists, the alert can be removed programmatically using remove

Returns:

Same badge instance

public boolean isRemovable()
Use to check if the badge is removable or not

Returns:

a boolean, true if removable and false otherwise.

public RemoveButton getCloseButton()
Use to get a reference to the close button, calling this will assume the badge should be removable and will add the remove button to the badge

Returns:

the close button element

public Badge withCloseButton(ChildHandler<Badge, RemoveButton> handler)
Use to customize the close button without breaking the fluent API chain. using this method will produce the same behavior as the getCloseButton method, it will add the remove button to the badge

handler

a ChildHandler to applied on the remove button



Returns:

same badge instance

public Badge withCloseButton()
Adds the remove button to the badge.

Returns:

same badge instance

public Badge setText(String text)
Sets the html textContent of the badge element.

text

the new content



Returns:

same badge instance

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

Donate & Support Us