Icon-only mode
When icon-only is set, the text is hidden and reappears as a tooltip on hover. This is how NbTextInput uses NbMessage in the fluid variant to keep the field compact.
vue
<template>
<NbMessage variant="error" icon-only>This field is required.</NbMessage>
</template>Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'error' | 'warning' | 'success' | 'helper' | 'helper' | Controls color and icon |
iconOnly | boolean | false | Shows only the icon; text visible on hover via tooltip |
Slots
| Slot | Description |
|---|---|
default | The message text (shown or in tooltip) |
Icon mapping
| Variant | Icon | Color |
|---|---|---|
error | warning-circle | --nb-c-danger |
warning | warning | --nb-c-warning |
success | check-circle | --nb-c-success |
helper | info | --nb-c-text-subtle |
Accessibility
- Root element has
role="status". - Errors use
aria-live="assertive"; warnings, successes and helpers usearia-live="polite". - The tooltip in
iconOnlymode isaria-hidden; ensure error state is also communicated via the input'saria-describedbyoraria-invalid.