Generates a Bootstrap badge displaying a collection name with automatic truncation and tooltip for long names. Uses consistent styling across the browse interface and provides visual hierarchy for collection context.
Use this when displaying collection names in headers, cards, or navigation elements. The function handles edge cases (NULL, NA, empty strings) gracefully and provides tooltips only when truncation occurs.
Arguments
- label
Character. Collection name to display. Returns NULL if the label is NULL, NA, or empty string.
- max_length
Numeric. Maximum character length before truncation. Default 24. Longer names are truncated with "..." and show full name in tooltip on hover.
- tooltip_placement
Character. Bootstrap tooltip placement: "top", "bottom", "left", "right". Default "top".
Value
A `shiny.tag` (span element with badge class), or NULL if label is invalid. Badge includes [bslib::tooltip()] wrapper if truncated.
See also
Other helpers:
addBadgeNFT(),
addBadgeVariants(),
artDisplayCard()
Examples
createCollectionLabelBadge("My Collection")
#> <span class="badge bg-warning collection-label-badge">My Collection</span>
createCollectionLabelBadge("Very Long Collection Name That Exceeds Limit", max_length = 20)
#> <div class="container-fluid">
#> <bslib-tooltip placement="top" bsOptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()">
#> <template>Very Long Collection Name That Exceeds Limit</template>
#> <span class="badge bg-warning collection-label-badge">Very Long Collect...</span>
#> </bslib-tooltip>
#> </div>
createCollectionLabelBadge(NULL)
#> NULL
