hydroxy

Notification center

A bell with an unread count that opens a list of notifications. Mark them read one at a time or all at once, dismiss them, and see an empty state when none are left.

Last opened: none yet

Usage

use hydroxy_leptos::notification_center::*;
use leptos::prelude::*;

#[component]
pub fn Demo() -> impl IntoView {
    let (opened, set_opened) = signal(String::from("none yet"));

    view! {
        <div style="display: flex; align-items: center; gap: var(--space-5);">
            // Uncontrolled. Opening a notification marks it read; dismissing removes it.
            <NotificationCenter
                placement=Placement::new(Side::Bottom, Align::Start)
                default_items=vec![
                    Notification::new("deploy", "Deploy finished", "2m ago").description("Production is on build 482."),
                    Notification::new("comment", "Maya commented on Q3 summary", "18m ago")
                        .description("\"Can we add the churn numbers?\""),
                    Notification::new("invite", "Lee accepted your invite", "1h ago"),
                    Notification::new("export", "Export is ready", "Yesterday").read(),
                ]
                on_select=move |id| set_opened.set(id)
            />
            <span>"Last opened: " {opened}</span>
        </div>
    }
}

Anatomy

Componentdata-partRenders
NotificationCentertriggerIcon button with popovertarget. aria-label includes the unread count
badgeThe unread count, capped at 99+. Hidden at zero
contentpopover=auto, role=dialog, labelled by the title
header / title / mark-allHeading row with the Mark all read button
list / itemul of notifications; unread ones have data-unread
item-buttonOpens the notification and marks it read
dismissIcon button that removes the notification
emptyShown when the list is empty

Keyboard

KeyDoes
Enter / SpaceOn the bell: opens the list. On a row: opens it. On a button: activates it
Tab / Shift+TabMoves through rows, dismiss buttons and Mark all read
EscapeCloses the list and returns focus to the bell

Props

PropTypeNotes
itemsOption<Vec<Notification>>Controlled notifications. Pair with on_items_change
default_itemsVec<Notification>Initial notifications when uncontrolled
labelStringAccessible name of the bell and heading. Default Notifications
placementPlacementWhere the list sits. Default below, end-aligned
on_items_changeCallback<Vec<Notification>>Called with the new list when it changes or is requested
on_selectCallback<String>Called with the id of a notification when it is opened
Actions
Button
Icon button
Toolbar
Theme menu
Display
Avatar
Badge
Card
Chip
Code block
Markdown
Doc card
Due pill
Kbd
Priority mark
Source chip
Space icon
Status diamond
Tag
Value diff
Carousel
Reveal
Media timeline
QR code
Transcript viewer
Audio waveform
Audio player
Forms
Calendar
Checkbox
Combobox
Date picker
Color picker
Cron builder
Theme editor
Mention input
Signature pad
Image cropper
Date field
Date range picker
Duration field
Quantity stepper
Filter chip
Input
Markdown editor
Radio group
Search field
Segmented control
Select
Slider
Range slider
Rating
Toggle button
File dropzone
Upload queue
Attachment
Switch
Tags input
Number field
Money field
Phone field
Time field
OTP input
Password field
Questionnaire
Availability picker
Voice input
Recording control
Inline edit
Async validated input
Shortcut recorder
Data
Spreadsheet grid
Week scheduler
Virtual list
Stat card
Step track
Kanban board
Sortable list
Filter builder
Data table
Grid
Access editor
File manager
Gantt chart
Log stream
Diff viewer
JSON inspector
Terminal
Node editor
Whiteboard
Navigation
Table of contents
Breadcrumb
Tabs
Wizard
Nav item
Nav section
Tree view
Pagination
Menubar
Navigation menu
Saved views
Layout
Master detail
App shell
Sidebar layout
Resizable panels
Dashboard layout
Dock layout
Feedback
Callout
Check list
Empty state
Progress bar
Toast
Approval card
Skeleton
Notification center
Bars
Bar chart
Diverging bar chart
Span chart
Pictogram chart
Stacked bar chart
Funnel chart
Bullet chart
Waffle chart
Marimekko chart
Dot plot chart
Error bar chart
Pareto chart
Waterfall chart
Lollipop chart
Grouped bar chart
Bar race chart
KPIs and frames
Chart frame
Metric card
Sparkline
Points
Scatter chart
Smith chart
Strip plot
Beeswarm chart
Parallel coordinates
Ternary chart
Bland-Altman chart
Quiver chart
Connected scatter chart
Grids and tables
Heatmap chart
Chart table
Cohort chart
Radial
Radial charts
Radar chart
Polar area chart
Stat ring
Clock chart
Spiral chart
Lines and areas
Bump chart
Slope chart
Line chart
Composed chart
Small multiples
Cycle plot chart
Horizon chart
Stacked area chart
Threshold chart
Split line chart
Linked charts
Confidence band chart
Forecast fan chart
Step chart
Range area chart
Distributions
Contour chart
Histogram
Box plot
Density chart
Ridgeline chart
Violin chart
Q-Q chart
Survival chart
ECDF chart
Raincloud plot
Forest plot
Maps
Geo map
Bubble map
Hexbin map
Cartogram
Flow map
Parts of a whole
Donut chart
Voronoi treemap
Nested donut chart
Treemap chart
Sunburst chart
Bubble pack chart
Icicle chart
Flame graph chart
Pie chart
Word cloud
Relationships
Sankey chart
Network chart
Chord chart
UpSet chart
Venn chart
Alluvial chart
Adjacency matrix chart
Dependency graph chart
Tree chart
Arc diagram
Hive plot
Edge bundling
Finance
Candlestick chart
OHLC chart
Depth chart
Renko chart
Time
Timeline chart
Calendar heatmap chart
Spectrogram chart
Marey chart
Overlays
Tour
Lightbox
Alert dialog
Command palette
Dialog
Menu
Popover
Tooltip
Sheet
Hover card
Context menu
Utilities
Pacer
Hotkeys
Disclosure
Accordion
Collapsible
Chat
Chat bubble
Voice session
Composer
Thread
Thread list
Assistant composer
Assistant MCP
Assistant modal
Assistant thread
Assistant thread list
Message scroller
Insight note
Emoji picker
Tool trace
Model picker
Citation popover
Activity
Activity feed
Comment thread
Timeline
Presence bar
Live cursors
Reaction bar
Guides
Getting started
All components
All charts