NotificationCenter
Dropdown notification hub built on Bootstrap dropdowns.
Quick Start
Live Preview
Items
Each item can be:
- a
(label, href)tuple - a plain string
- a custom FastHTML node
Lazy Load With HTMX
When endpoint is provided, the dropdown menu is loaded on click.
Customization
badge_variantcontrols the badge colormenu_clsandbutton_clslet you style the dropdownmax_itemscaps visible itemsempty_textsets the empty state
Security Notes
If you load notifications over HTMX, ensure the endpoint is authenticated and returns only the current user's data.
API Reference
faststrap.components.feedback.notification_center.NotificationCenter(*items, count=None, title='Notifications', endpoint=None, center_id=None, menu_cls=None, button_cls=None, badge_variant=None, empty_text='No notifications', max_items=None, hx_swap='innerHTML', push_url=False, **kwargs)
Notification bell + dropdown menu.
Source code in src/faststrap/components/feedback/notification_center.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |