Indicator is used to place an element at the corner of another element. Perfect for notifications, badges, and status indicators.
Basic Example
Notification badge on inbox
await import('/components/layout/indicator.js');
await import('/components/data-display/badge.js');
await import('/components/actions/button.js');
const { signal, tags, $ } = Lightview;
const { div, img, Indicator, Badge, Button } = tags;
const count = signal(3);
const demo = div({ style: 'display: flex; gap: 2rem' },
Indicator({},
Indicator.Item({},
Badge({ color: 'primary' }, () => count.value)
),
Button({
onclick: () => { count.value++; }
}, 'Messages')
),
Indicator({},
Indicator.Item({ position: 'bottom-end' },
Badge({ color: 'success', size: 'xs' })
),
div({ class: 'avatar' },
div({ class: 'w-12 rounded-full' },
img({ src: 'https://i.pravatar.cc/100?img=5' })
)
)
)
);
$('#example').content(demo);
Indicator.Item Props
| Prop | Type | Default | Description |
|---|---|---|---|
position |
string | 'top-end' | 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' |
Indicator Gallery
Live examples using <lv-indicator> custom elements.
Top Positions
content
content
content
Bottom Positions
content
content
content