Nudge Banner
Guidance component
<loquix-nudge-banner> carries a short contextual message — a tip about a feature the user has not tried, a note about a limit they are approaching. It can be dismissed and can carry one call to action.
Preview
Section titled “Preview”import '@loquix/core/define/define-nudge-banner';<loquix-nudge-banner nudge-id="tip-shortcuts" variant="tip" icon="💡" action-label="Show shortcuts"> Press ⌘K from anywhere to search.</loquix-nudge-banner>const nudge = document.querySelector('loquix-nudge-banner');
nudge.addEventListener('loquix-nudge-dismiss', (event) => { rememberDismissed(event.detail.nudgeId);});
nudge.addEventListener('loquix-nudge-action', () => { openShortcutHelp();});Variants
Section titled “Variants”| Variant | Use it for |
|---|---|
tip |
Something the user could try. The default. |
info |
Neutral context about the current state. |
warning |
Something that needs attention before it becomes a problem. |
Properties
Section titled “Properties”| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
nudgeId |
nudge-id |
string |
'' |
Identifier echoed in the dismiss event. |
variant |
variant |
'info' | 'tip' | 'warning' |
'tip' |
Visual variant. |
dismissible |
dismissible |
boolean |
true |
Whether the dismiss button is shown. |
actionLabel |
action-label |
string |
'' |
Label for the action button. Empty means no button. |
icon |
icon |
string |
'' |
Emoji or text icon. |
Events
Section titled “Events”| Event | Detail | Description |
|---|---|---|
loquix-nudge-dismiss |
{ nudgeId } |
Fired when the banner is dismissed. |
loquix-nudge-action |
{ nudgeId, action } |
Fired when the action button is clicked. action is the button’s label. |
| Slot | Purpose |
|---|---|
| default | The banner text. |
icon |
Custom icon, overriding the icon property. |
action |
Custom action control, overriding actionLabel. |
CSS parts
Section titled “CSS parts”| Part | Purpose |
|---|---|
banner |
The banner container. |
dismiss |
The dismiss button. |
action-button |
The action button. |
CSS custom properties
Section titled “CSS custom properties”| Variable | Purpose |
|---|---|
--loquix-nudge-bg |
Background color. |
--loquix-nudge-color |
Text color. |
--loquix-nudge-border-color |
Border color. |
--loquix-nudge-border-radius |
Border radius. |
--loquix-nudge-padding |
Padding. |
--loquix-nudge-gap |
Gap between elements. |
--loquix-nudge-font-size |
Font size. |