Glass notification
A glass notification pill (icon + copy + action) and a stack of three; the self-close timer runs out as a progress bar, freezes under the pointer or focus, and a button closes it anyway.
Real scenarios
The component as it is used in a product — not a specimen grid.
One pill, its own countdown
Icon, copy, an action and a close — the hair at the bottom drains the clock; hover it (or tab into its buttons) and the clock stands still until you leave.
Singapore region is live
The stack, three clocks ticking
A shipped build, a climbing error rate and the weekly digest — each with its own pace and its own tone; hover any of them to hold its clock, close it yourself, or replay the feed once it goes quiet.
Build 842 shipped to Frankfurt
Error rate climbing in Dublin
Your weekly digest is ready
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| duration | ms | '7000' | The toast’s lifetime; the timer drains along the hairline at the bottom and the toast closes itself at the end. |
| pause-on-hover | boolean | true | Hover or keyboard focus holds the clock; without it the toast dies under your hand. |
| tone | success · warning · info | 'info' | Tints the icon chip and the progress bar; warning takes the alert role, the rest status. |
| action | label · handler | null | The action at the pill’s end; it sits beside the close button and shares the same hover-hold. |
Snippet
<div class="gnt-toast" data-tone="success" role="status"
@mouseenter="$set('paused', true)" @mouseleave="$set('paused', false)">
<span class="gnt-icon">…check…</span>
<div class="gnt-body">
<p class="gnt-title">Build 842 shipped to Frankfurt</p>
<p class="gnt-meta">2 minutes ago · rollback open for an hour</p>
</div>
<button type="button" wire:click="viewBuild">View</button>
<button type="button" wire:click="dismiss" aria-label="Close notification">…x…</button>
<i class="gnt-bar" style="inline-size: 64%"></i>
</div>
<style>
.gnt-toast { position: relative; display: flex; align-items: center; gap: .75rem;
inline-size: min(100%, 28rem); padding: .8rem .9rem; border-radius: 1.1rem; overflow: clip;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 14px 34px #00000029; }
.gnt-bar { position: absolute; inset-block-end: 0; inset-inline-start: 0; block-size: 3px;
border-radius: 999px; background: #12a150; transition: inline-size .12s linear; }
</style>
// app/Pages/Feed.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import NotificationFeed from '@/components/NotificationFeed';
export default function Feed() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<NotificationFeed />
</main>
</NabuXUIProvider>
);
}
// NotificationFeed.jsx — glass toasts, self-closing, hover freezes the clock
import { useEffect, useRef, useState } from 'react';
import '@nabuxai/ui-core/css';
const FEED = [
{ id: 1, tone: 'success', title: 'Build 842 shipped to Frankfurt',
meta: '2 minutes ago · rollback open for an hour', action: 'View', dur: 6200 },
{ id: 2, tone: 'warning', title: 'Error rate climbing in Dublin',
meta: 'Checkout API · 2.4% of requests 5xx', action: 'Inspect', dur: 10600 },
{ id: 3, tone: 'info', title: 'Your weekly digest is ready',
meta: '12 deploys · 3 incidents', action: 'Read', dur: 8800 },
];
export default function NotificationFeed() {
const [left, setLeft] = useState(() => Object.fromEntries(FEED.map((n) => [n.id, n.dur])));
const [paused, setPaused] = useState(null);
const raf = useRef();
useEffect(() => {
let was = performance.now();
const step = (now) => {
const dt = now - was; was = now;
setLeft((l) => {
const next = {};
for (const [id, v] of Object.entries(l)) {
next[id] = +id === paused || v <= 0 ? v : Math.max(0, v - dt);
}
return next;
});
raf.current = requestAnimationFrame(step);
};
raf.current = requestAnimationFrame(step);
return () => cancelAnimationFrame(raf.current);
}, [paused]);
return (
<>
<style>{`
.gnt-toast { position: relative; display: flex; align-items: center; gap: .75rem;
inline-size: min(100%, 28rem); padding: .8rem .9rem; border-radius: 1.1rem; overflow: clip;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 14px 34px #0003; }
.gnt-toast[data-tone='success'] { --tone: #12a150; }
.gnt-toast[data-tone='warning'] { --tone: #c07807; }
.gnt-toast[data-tone='info'] { --tone: #3d63dd; }
.gnt-icon { display: grid; place-items: center; inline-size: 2.15rem; aspect-ratio: 1;
border-radius: 50%; background: color-mix(in oklab, var(--tone) 24%, transparent); }
.gnt-bar { position: absolute; inset-block-end: 0; inset-inline-start: 0; block-size: 3px;
background: var(--tone); }
.gnt-x { margin-inline-start: auto; border: none; background: none; cursor: pointer; }
`}</style>
<div className="gnt-stack" style={{ display: 'grid', gap: '.8rem', justifyItems: 'center' }}>
{FEED.filter((n) => left[n.id] > 0).map((n) => (
<div key={n.id} className="gnt-toast" data-tone={n.tone} role="status"
onMouseEnter={() => setPaused(n.id)} onMouseLeave={() => setPaused(null)}
onFocus={() => setPaused(n.id)} onBlur={() => setPaused(null)}>
<span className="gnt-icon" style={{ color: 'var(--tone)' }}>●</span>
<div className="gnt-body">
<strong>{n.title}</strong>
<small>{n.meta}</small>
</div>
<button type="button" className="gnt-act">{n.action}</button>
<button type="button" className="gnt-x" aria-label="Close notification"
onClick={() => setLeft((l) => ({ ...l, [n.id]: 0 }))}>×</button>
<i className="gnt-bar" style={{ inlineSize: `${Math.max(0, (left[n.id] / n.dur) * 100)}%` }} />
</div>
))}
</div>
</>
);
}
<!-- NotificationFeed.vue — glass toasts, self-closing, hover freezes the clock -->
<script setup lang="ts">
import { onMounted, onUnmounted, reactive, ref } from 'vue';
import '@nabuxai/ui-core/css';
const feed = [
{ id: 1, tone: 'success', title: 'Build 842 shipped to Frankfurt',
meta: '2 minutes ago · rollback open for an hour', action: 'View', dur: 6200 },
{ id: 2, tone: 'warning', title: 'Error rate climbing in Dublin',
meta: 'Checkout API · 2.4% of requests 5xx', action: 'Inspect', dur: 10600 },
{ id: 3, tone: 'info', title: 'Your weekly digest is ready',
meta: '12 deploys · 3 incidents', action: 'Read', dur: 8800 },
];
const left = reactive(Object.fromEntries(feed.map((n) => [n.id, n.dur])));
const paused = ref<number | null>(null);
let timer: number | undefined;
onMounted(() => {
timer = window.setInterval(() => {
for (const n of feed) {
if (paused.value === n.id || left[n.id] <= 0) continue;
left[n.id] = Math.max(0, left[n.id] - 100);
}
}, 100);
});
onUnmounted(() => window.clearInterval(timer));
const pct = (id: number) => (left[id] / feed.find((n) => n.id === id)!.dur) * 100;
</script>
<template>
<div class="gnt-stack">
<div v-for="n in feed.filter((n) => left[n.id] > 0)" :key="n.id"
class="gnt-toast" :data-tone="n.tone" role="status"
@mouseenter="paused = n.id" @mouseleave="paused = null"
@focusin="paused = n.id" @focusout="paused = null">
<span class="gnt-icon">●</span>
<div class="gnt-body">
<strong>{{ n.title }}</strong>
<small>{{ n.meta }}</small>
</div>
<button type="button" class="gnt-act">{{ n.action }}</button>
<button type="button" class="gnt-x" aria-label="Close notification"
@click="left[n.id] = 0">×</button>
<i class="gnt-bar" :style="{ inlineSize: pct(n.id) + '%' }"></i>
</div>
</div>
</template>
<style scoped>
.gnt-toast { position: relative; display: flex; align-items: center; gap: .75rem;
inline-size: min(100%, 28rem); padding: .8rem .9rem; border-radius: 1.1rem; overflow: clip;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 14px 34px #0003; }
.gnt-toast[data-tone='success'] { --tone: #12a150; }
.gnt-toast[data-tone='warning'] { --tone: #c07807; }
.gnt-toast[data-tone='info'] { --tone: #3d63dd; }
.gnt-icon { display: grid; place-items: center; inline-size: 2.15rem; aspect-ratio: 1;
border-radius: 50%; background: color-mix(in oklab, var(--tone) 24%, transparent); color: var(--tone); }
.gnt-bar { position: absolute; inset-block-end: 0; inset-inline-start: 0; block-size: 3px;
background: var(--tone); transition: inline-size .12s linear; }
.gnt-x { margin-inline-start: auto; border: none; background: none; cursor: pointer; }
</style>
<!-- NotificationFeed.svelte — glass toasts, self-closing, hover freezes the clock -->
<script lang="ts">
import { onMount } from 'svelte';
import '@nabuxai/ui-core/css';
const feed = [
{ id: 1, tone: 'success', title: 'Build 842 shipped to Frankfurt',
meta: '2 minutes ago · rollback open for an hour', action: 'View', dur: 6200 },
{ id: 2, tone: 'warning', title: 'Error rate climbing in Dublin',
meta: 'Checkout API · 2.4% of requests 5xx', action: 'Inspect', dur: 10600 },
{ id: 3, tone: 'info', title: 'Your weekly digest is ready',
meta: '12 deploys · 3 incidents', action: 'Read', dur: 8800 },
];
let left = $state(Object.fromEntries(feed.map((n) => [n.id, n.dur])));
let paused = $state<number | null>(null);
const pct = (id: number) => (Math.max(0, left[id]) / feed.find((n) => n.id === id)!.dur) * 100;
onMount(() => {
const timer = setInterval(() => {
for (const n of feed) {
if (paused === n.id || left[n.id] <= 0) continue;
left[n.id] = Math.max(0, left[n.id] - 100);
}
}, 100);
return () => clearInterval(timer);
});
</script>
<div class="gnt-stack">
{#each feed.filter((n) => left[n.id] > 0) as n (n.id)}
<div class="gnt-toast" data-tone={n.tone} role="status"
onmouseenter={() => (paused = n.id)} onmouseleave={() => (paused = null)}
onfocusin={() => (paused = n.id)} onfocusout={() => (paused = null)}>
<span class="gnt-icon">●</span>
<div class="gnt-body">
<strong>{n.title}</strong>
<small>{n.meta}</small>
</div>
<button type="button" class="gnt-act">{n.action}</button>
<button type="button" class="gnt-x" aria-label="Close notification"
onclick={() => (left[n.id] = 0)}>×</button>
<i class="gnt-bar" style="inline-size: {pct(n.id)}%"></i>
</div>
{/each}
</div>
<style>
.gnt-toast { position: relative; display: flex; align-items: center; gap: .75rem;
inline-size: min(100%, 28rem); padding: .8rem .9rem; border-radius: 1.1rem; overflow: clip;
background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.44);
backdrop-filter: blur(16px) saturate(1.4);
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 14px 34px #0003; }
.gnt-toast[data-tone='success'] { --tone: #12a150; }
.gnt-toast[data-tone='warning'] { --tone: #c07807; }
.gnt-toast[data-tone='info'] { --tone: #3d63dd; }
.gnt-icon { display: grid; place-items: center; inline-size: 2.15rem; aspect-ratio: 1;
border-radius: 50%; background: color-mix(in oklab, var(--tone) 24%, transparent); color: var(--tone); }
.gnt-bar { position: absolute; inset-block-end: 0; inset-inline-start: 0; block-size: 3px;
background: var(--tone); transition: inline-size .12s linear; }
.gnt-x { margin-inline-start: auto; border: none; background: none; cursor: pointer; }
</style>