Skip to main content

Label Component

Figma

The glu-label component provides a styled label with support for an optional tooltip icon and an optional right-aligned text (for example, a character counter). The label text is provided via the default slot, while additional information can be supplied via the tooltip and right-text slots.

Basic Usage

Example 1: Simple Label

Display a simple label without any additional elements.

Result
Loading...
Live Editor
<glu-label>
  Nombre
</glu-label>

Label with Tooltip

Enable the tooltip by setting the showTooltip property. Use the tooltip slot to provide additional help text. You can also customize the tooltip icon by specifying the tooltipIcon and its variant via the iconVariation property.

Result
Loading...
Live Editor
<glu-label showTooltip>
  Nombre
  <span slot="tooltip">Este campo es obligatorio</span>
</glu-label>

Label with Right Text

Display right-aligned text such as a character counter by enabling the showRightText property and using the right-text slot.

Result
Loading...
Live Editor
<glu-label showRightText>
  Nombre
  <span slot="right-text">0 / 100</span>
</glu-label>

Combined Example

Use both tooltip and right text in a single label. Customize the tooltip icon and its variant as needed.

Result
Loading...
Live Editor
<glu-label showTooltip showRightText tooltipIcon="information-circle" iconVariation="solid">
  Nombre
  <span slot="tooltip">Proporcione su nombre completo</span>
  <span slot="right-text">0 / 100</span>
</glu-label>

Properties

PropertyAttributeDescriptionTypeDefault
iconVariationicon-variationIf true, displays the icon in its solid variant."outline" | "solid"'outline'
showRightTextshow-right-textIf true, displays a right text like character counter ("0 / 100") at the opposite end (right side) of the label.booleanfalse
showTooltipshow-tooltipIf true, displays a tooltip icon (using the glu-icon component) right next to the label text.booleanfalse
tooltipIcontooltip-iconIf true, displays the icon in its solid variant.string'question-mark-circle'

Slots

SlotDescription
The label text.
"right-text"The right text.
"tooltip"The tooltip text.

Dependencies

Used by

Depends on

Graph


Built with StencilJS