Documentation
Data display
FloatingBadge
Shows a high-emphasis notification count over an icon, avatar, or control.
01
See it in context
Preview
12AT3
02
Copy a working example
Usage
---
import {
Avatar,
Button,
FloatingBadge,
Icon
} from '@santi020k/lumen-astro'
---
<div style="display: flex; gap: 2rem; align-items: center;">
<span style="display: inline-flex; position: relative;">
<Button variant="outline" size="icon" aria-label="Inbox">
<Icon name="inbox" decorative />
</Button>
<FloatingBadge
aria-label="12 unread messages"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
12
</FloatingBadge>
</span>
<span style="display: inline-flex; position: relative;">
<Avatar aria-label="Ana Torres">AT</Avatar>
<FloatingBadge
aria-label="3 notifications"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
3
</FloatingBadge>
</span>
</div>---
import {
Avatar,
Button,
FloatingBadge,
Icon
} from '@santi020k/lumen-astro'
---
<div style="display: flex; gap: 2rem; align-items: center;">
<span style="display: inline-flex; position: relative;">
<Button variant="outline" size="icon" aria-label="Inbox">
<Icon name="inbox" decorative />
</Button>
<FloatingBadge
aria-label="12 unread messages"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
12
</FloatingBadge>
</span>
<span style="display: inline-flex; position: relative;">
<Avatar aria-label="Ana Torres">AT</Avatar>
<FloatingBadge
aria-label="3 notifications"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
3
</FloatingBadge>
</span>
</div>import { Avatar, Button, FloatingBadge, Icon } from '@santi020k/lumen-react'
export const Example = () => (
<>
<div style={{ display: 'flex', gap: '2rem', alignItems: 'center' }}>
<span style={{ display: 'inline-flex', position: 'relative' }}>
<Button variant="outline" size="icon" aria-label="Inbox">
<Icon name="inbox" decorative />
</Button>
<FloatingBadge
aria-label="12 unread messages"
style={{ position: 'absolute', right: '-0.65rem', top: '-0.65rem' }}
>
12
</FloatingBadge>
</span>
<span style={{ display: 'inline-flex', position: 'relative' }}>
<Avatar aria-label="Ana Torres">AT</Avatar>
<FloatingBadge
aria-label="3 notifications"
style={{ position: 'absolute', right: '-0.65rem', top: '-0.65rem' }}
>
3
</FloatingBadge>
</span>
</div>
</>
)import { Avatar, Button, FloatingBadge, Icon } from '@santi020k/lumen-react'
export const Example = () => (
<>
<div style={{ display: 'flex', gap: '2rem', alignItems: 'center' }}>
<span style={{ display: 'inline-flex', position: 'relative' }}>
<Button variant="outline" size="icon" aria-label="Inbox">
<Icon name="inbox" decorative />
</Button>
<FloatingBadge
aria-label="12 unread messages"
style={{ position: 'absolute', right: '-0.65rem', top: '-0.65rem' }}
>
12
</FloatingBadge>
</span>
<span style={{ display: 'inline-flex', position: 'relative' }}>
<Avatar aria-label="Ana Torres">AT</Avatar>
<FloatingBadge
aria-label="3 notifications"
style={{ position: 'absolute', right: '-0.65rem', top: '-0.65rem' }}
>
3
</FloatingBadge>
</span>
</div>
</>
)<script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<div style="display: flex; gap: 2rem; align-items: center;">
<span style="display: inline-flex; position: relative;">
<lumen-button variant="outline" size="icon" aria-label="Inbox">
<lumen-icon name="inbox" decorative></lumen-icon>
</lumen-button>
<lumen-floating-badge
aria-label="12 unread messages"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
12
</lumen-floating-badge>
</span>
<span style="display: inline-flex; position: relative;">
<lumen-avatar aria-label="Ana Torres">AT</lumen-avatar>
<lumen-floating-badge
aria-label="3 notifications"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
3
</lumen-floating-badge>
</span>
</div><script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<div style="display: flex; gap: 2rem; align-items: center;">
<span style="display: inline-flex; position: relative;">
<lumen-button variant="outline" size="icon" aria-label="Inbox">
<lumen-icon name="inbox" decorative></lumen-icon>
</lumen-button>
<lumen-floating-badge
aria-label="12 unread messages"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
12
</lumen-floating-badge>
</span>
<span style="display: inline-flex; position: relative;">
<lumen-avatar aria-label="Ana Torres">AT</lumen-avatar>
<lumen-floating-badge
aria-label="3 notifications"
style="position: absolute; right: -0.65rem; top: -0.65rem;"
>
3
</lumen-floating-badge>
</span>
</div>03
Choose your target
Add this component
Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.
pnpm add @santi020k/lumen-astropnpm add @santi020k/lumen-astrolumen add FloatingBadgelumen add FloatingBadgepnpm add @santi020k/lumen-reactpnpm add @santi020k/lumen-reactlumen add FloatingBadge --target reactlumen add FloatingBadge --target reactpnpm add @santi020k/lumen-elementspnpm add @santi020k/lumen-elementslumen add FloatingBadge --target elementslumen add FloatingBadge --target elementsAPI reference
Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.
| Attribute | Values | Default | Description |
|---|---|---|---|
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
| ...native attributes | HTML attributes | - | Forwards standard attributes to the root element unless the component consumes them. |