x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<div class="tw:p-6 tw:max-w-7xl tw:mx-auto tw:space-y-8">
<!-- Introductory callout -->
<div class="tw-callout">
<p class="tw:mb-1 tw:text-sm tw:font-mono">
<strong>FLOATING NOTIFICATION:</strong> Non-blocking toast-style notifications<br>
<strong>CLASSES:</strong> .tw-floating-notification-container | .tw-floating-notification | .tw-floating-notification-visible | .tw-floating-notification-icon | .tw-floating-notification-content | .tw-floating-notification-title | .tw-floating-notification-message | .tw-floating-notification-progress | .tw-floating-notification-actions | .tw-floating-notification-close
</p>
<p class="tw:mb-0 tw:text-sm">
Toast notifications that appear in the top-right corner, auto-dismiss after a configurable duration,
and support stacking. Uses neutral white cards with elevated shadow. Hover pauses the auto-dismiss timer.
Requires <code>floating_notification_controller.js</code> for animation and auto-dismiss behavior.
</p>
</div>
<!-- ============================================
Section 1: Basic Notification
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Basic Notification</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Basic:</strong> A simple notification with title and close button. The
<code>.tw-floating-notification-visible</code> class is applied inline here for static display.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application saved</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification tw-floating-notification-visible"><br>
  <div class="tw-floating-notification-content"><br>
    <p class="tw-floating-notification-title">Application saved</p><br>
  </div><br>
  <button class="tw-floating-notification-close" type="button" aria-label="Close"><br>
    <i class="fa-solid fa-xmark"></i><br>
  </button><br>
</div></code>
</div>
</div>
<!-- ============================================
Section 2: With Title and Message
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">With Title and Message</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Title + Message:</strong> Use <code>.tw-floating-notification-title</code> for the bold heading
and <code>.tw-floating-notification-message</code> for a supporting description below.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application submitted</p>
<p class="tw-floating-notification-message">Your Year 7 application for Emma Johnson has been received. Confirmation sent to your email.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification tw-floating-notification-visible"><br>
  <div class="tw-floating-notification-content"><br>
    <p class="tw-floating-notification-title">Application submitted</p><br>
    <p class="tw-floating-notification-message">Description text...</p><br>
  </div><br>
  <button class="tw-floating-notification-close" ...>...</button><br>
</div></code>
</div>
</div>
<!-- ============================================
Section 3: With Icons
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">With Icons</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Icons:</strong> Add a <code>.tw-floating-notification-icon</code> element before the content area.
Uses Font Awesome 6 icons. The icon inherits neutral-600 color by default.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<!-- Info -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">New admissions cycle open</p>
<p class="tw-floating-notification-message">Year 7 entry for 2027 is now accepting applications.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Success -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Changes saved successfully</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Warning -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-orange-600">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Deadline approaching</p>
<p class="tw-floating-notification-message">Application deadline is in 3 days.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Error -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-red-600">
<i class="fa-solid fa-circle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Upload failed</p>
<p class="tw-floating-notification-message">The file exceeds the 10MB size limit. Please try a smaller file.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Loading -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-spinner fa-spin"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Generating report...</p>
<p class="tw-floating-notification-message">This may take a few moments.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Syncing -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-arrows-rotate fa-spin"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Syncing data</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification tw-floating-notification-visible"><br>
  <div class="tw-floating-notification-icon"><br>
    <i class="fa-solid fa-circle-info"></i><br>
  </div><br>
  <div class="tw-floating-notification-content">...</div><br>
  <button class="tw-floating-notification-close" ...>...</button><br>
</div></code>
<br>
<br>
<strong>Icon color override:</strong> Add Tailwind text color utilities to the icon element:<br>
<code>text-green-600</code> (success) | <code>text-orange-600</code> (warning) | <code>text-red-600</code> (error)
</div>
</div>
<!-- ============================================
Section 4: With Actions
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">With Actions</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Actions:</strong> Use <code>.tw-floating-notification-actions</code> inside the content area
for action buttons. Notifications with actions auto-dismiss after 7 seconds instead of 4.
Use <code>data-auto-dismiss="0"</code> to disable auto-dismiss for critical actions.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<!-- With primary action -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">New application received</p>
<p class="tw-floating-notification-message">Emma Johnson submitted a Year 7 application.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Review</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Undo action -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-red-600">
<i class="fa-regular fa-trash-can"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application archived</p>
<p class="tw-floating-notification-message">Moved to archived applications folder.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-warning" type="button">Undo</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Single action -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-download"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Export ready</p>
<p class="tw-floating-notification-message">Your CSV export is ready for download.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Download</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification-content"><br>
  <p class="tw-floating-notification-title">Title</p><br>
  <p class="tw-floating-notification-message">Message</p><br>
  <div class="tw-floating-notification-actions"><br>
    <button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Action</button><br>
    <button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button><br>
  </div><br>
</div></code>
</div>
</div>
<!-- ============================================
Section 5: Full Example
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Full Example</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Full Example:</strong> Combines icon, title, message, actions, and close button.
This matches the primary design spec for the component.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application submitted successfully</p>
<p class="tw-floating-notification-message">Year 7 entry application for Emma Johnson has been submitted. A confirmation email has been sent to the registered email address.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">View application</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
</div>
<!-- ============================================
Section 6: Progress Bar
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Progress Bar</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Progress:</strong> The <code>.tw-floating-notification-progress</code> wrapper is hidden by default
and becomes visible when it contains child content. Nest a <code>.progress</code> / <code>.progress-bar</code>
component inside for determinate or indeterminate states.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<!-- Determinate progress -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-cloud-arrow-up"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Uploading documents...</p>
<p class="tw-floating-notification-message">3 of 5 files uploaded</p>
<div class="tw-floating-notification-progress">
<div class="tw-progress" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
<div class="tw-progress-bar tw-progress-bar-primary" style="width: 60%"></div>
</div>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Indeterminate progress -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-cloud-arrow-up"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Processing upload...</p>
<p class="tw-floating-notification-message">Please wait while we process your files</p>
<div class="tw-floating-notification-progress">
<div class="tw-progress tw-progress-indeterminate" role="progressbar">
<div class="tw-progress-bar tw-progress-bar-primary"></div>
</div>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification-progress"><br>
  <div class="tw-progress" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"><br>
    <div class="tw-progress-bar tw-progress-bar-primary" style="width: 60%"></div><br>
  </div><br>
</div></code>
<br>
<br>
<em>Use <code>.progress-indeterminate</code> for unknown completion (e.g., processing uploads).</em>
</div>
</div>
<!-- ============================================
Section 7: Stacked Notifications
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Stacked Notifications</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Stacking:</strong> Multiple notifications stack vertically with a <code>gap-3</code> gap
inside the <code>.tw-floating-notification-container</code>. Newest notifications appear at the top.
This static example simulates the stacking layout without fixed positioning.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Changes saved</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">2 new applications received</p>
<p class="tw-floating-notification-message">Applications from Oliver Smith and Amelia Brown are ready for review.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-orange-600">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Session expiring soon</p>
<p class="tw-floating-notification-message">Your session will expire in 5 minutes. Save your work.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Extend session</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
</div>
<!-- ============================================
Section 8: Interactive Demo
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Interactive Demo</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Live:</strong> These notifications use <code>data-controller="floating-notification"</code>
for real slide-in animation and auto-dismiss. They are positioned inside a relative container for this demo
instead of the fixed top-right position used in production.
Hover over a notification to pause its auto-dismiss timer.
</p>
</div>
<div data-controller="floating-notification"
class="tw:relative tw:overflow-hidden tw:rounded-lg tw:bg-neutral-100 tw:p-4"
class="tw:min-h-[280px]">
<!-- Demo container replaces fixed positioning for preview context -->
<div class="tw:flex tw:flex-col tw:gap-3 tw:items-end">
<div class="tw-floating-notification"
data-floating-notification-target="notification"
data-auto-dismiss="0"
role="status">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Settings updated</p>
<p class="tw-floating-notification-message">Your notification preferences have been saved.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close"
data-action="click->floating-notification#dismiss">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification"
data-floating-notification-target="notification"
data-auto-dismiss="0"
role="status">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Report generated</p>
<p class="tw-floating-notification-message">Admissions summary for Term 1 is ready.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Download</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button"
data-action="click->floating-notification#dismiss">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close"
data-action="click->floating-notification#dismiss">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification"
data-floating-notification-target="notification"
data-auto-dismiss="0"
role="status">
<div class="tw-floating-notification-icon tw:text-orange-600">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">3 applications pending review</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close"
data-action="click->floating-notification#dismiss">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification-container"<br>
     data-controller="floating-notification"<br>
     role="status" aria-live="polite"><br>
  <div class="tw-floating-notification"<br>
       data-floating-notification-target="notification"><br>
    <div class="tw-floating-notification-icon">...</div><br>
    <div class="tw-floating-notification-content"><br>
      <p class="tw-floating-notification-title">Title</p><br>
      <p class="tw-floating-notification-message">Message</p><br>
    </div><br>
    <button class="tw-floating-notification-close"<br>
            data-action="click->floating-notification#dismiss"<br>
            aria-label="Close">...</button><br>
  </div><br>
</div></code>
<br>
<br>
<strong>Auto-dismiss:</strong> Default 4s | With actions 7s | <code>data-auto-dismiss="0"</code> to disable | <code>data-auto-dismiss="10000"</code> for custom duration
</div>
</div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
<div class="tw:p-6 tw:max-w-7xl tw:mx-auto tw:space-y-8">
<!-- Introductory callout -->
<div class="tw-callout">
<p class="tw:mb-1 tw:text-sm tw:font-mono">
<strong>FLOATING NOTIFICATION:</strong> Non-blocking toast-style notifications<br>
<strong>CLASSES:</strong> .tw-floating-notification-container | .tw-floating-notification | .tw-floating-notification-visible | .tw-floating-notification-icon | .tw-floating-notification-content | .tw-floating-notification-title | .tw-floating-notification-message | .tw-floating-notification-progress | .tw-floating-notification-actions | .tw-floating-notification-close
</p>
<p class="tw:mb-0 tw:text-sm">
Toast notifications that appear in the top-right corner, auto-dismiss after a configurable duration,
and support stacking. Uses neutral white cards with elevated shadow. Hover pauses the auto-dismiss timer.
Requires <code>floating_notification_controller.js</code> for animation and auto-dismiss behavior.
</p>
</div>
<!-- ============================================
Section 1: Basic Notification
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Basic Notification</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Basic:</strong> A simple notification with title and close button. The
<code>.tw-floating-notification-visible</code> class is applied inline here for static display.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application saved</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification tw-floating-notification-visible"><br>
  <div class="tw-floating-notification-content"><br>
    <p class="tw-floating-notification-title">Application saved</p><br>
  </div><br>
  <button class="tw-floating-notification-close" type="button" aria-label="Close"><br>
    <i class="fa-solid fa-xmark"></i><br>
  </button><br>
</div></code>
</div>
</div>
<!-- ============================================
Section 2: With Title and Message
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">With Title and Message</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Title + Message:</strong> Use <code>.tw-floating-notification-title</code> for the bold heading
and <code>.tw-floating-notification-message</code> for a supporting description below.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application submitted</p>
<p class="tw-floating-notification-message">Your Year 7 application for Emma Johnson has been received. Confirmation sent to your email.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification tw-floating-notification-visible"><br>
  <div class="tw-floating-notification-content"><br>
    <p class="tw-floating-notification-title">Application submitted</p><br>
    <p class="tw-floating-notification-message">Description text...</p><br>
  </div><br>
  <button class="tw-floating-notification-close" ...>...</button><br>
</div></code>
</div>
</div>
<!-- ============================================
Section 3: With Icons
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">With Icons</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Icons:</strong> Add a <code>.tw-floating-notification-icon</code> element before the content area.
Uses Font Awesome 6 icons. The icon inherits neutral-600 color by default.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<!-- Info -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">New admissions cycle open</p>
<p class="tw-floating-notification-message">Year 7 entry for 2027 is now accepting applications.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Success -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Changes saved successfully</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Warning -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-orange-600">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Deadline approaching</p>
<p class="tw-floating-notification-message">Application deadline is in 3 days.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Error -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-red-600">
<i class="fa-solid fa-circle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Upload failed</p>
<p class="tw-floating-notification-message">The file exceeds the 10MB size limit. Please try a smaller file.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Loading -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-spinner fa-spin"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Generating report...</p>
<p class="tw-floating-notification-message">This may take a few moments.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Syncing -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-arrows-rotate fa-spin"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Syncing data</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification tw-floating-notification-visible"><br>
  <div class="tw-floating-notification-icon"><br>
    <i class="fa-solid fa-circle-info"></i><br>
  </div><br>
  <div class="tw-floating-notification-content">...</div><br>
  <button class="tw-floating-notification-close" ...>...</button><br>
</div></code>
<br><br>
<strong>Icon color override:</strong> Add Tailwind text color utilities to the icon element:<br>
<code>text-green-600</code> (success) | <code>text-orange-600</code> (warning) | <code>text-red-600</code> (error)
</div>
</div>
<!-- ============================================
Section 4: With Actions
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">With Actions</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Actions:</strong> Use <code>.tw-floating-notification-actions</code> inside the content area
for action buttons. Notifications with actions auto-dismiss after 7 seconds instead of 4.
Use <code>data-auto-dismiss="0"</code> to disable auto-dismiss for critical actions.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<!-- With primary action -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">New application received</p>
<p class="tw-floating-notification-message">Emma Johnson submitted a Year 7 application.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Review</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Undo action -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-red-600">
<i class="fa-regular fa-trash-can"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application archived</p>
<p class="tw-floating-notification-message">Moved to archived applications folder.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-warning" type="button">Undo</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Single action -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-download"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Export ready</p>
<p class="tw-floating-notification-message">Your CSV export is ready for download.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Download</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification-content"><br>
  <p class="tw-floating-notification-title">Title</p><br>
  <p class="tw-floating-notification-message">Message</p><br>
  <div class="tw-floating-notification-actions"><br>
    <button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Action</button><br>
    <button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button><br>
  </div><br>
</div></code>
</div>
</div>
<!-- ============================================
Section 5: Full Example
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Full Example</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Full Example:</strong> Combines icon, title, message, actions, and close button.
This matches the primary design spec for the component.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application submitted successfully</p>
<p class="tw-floating-notification-message">Year 7 entry application for Emma Johnson has been submitted. A confirmation email has been sent to the registered email address.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">View application</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
</div>
<!-- ============================================
Section 6: Progress Bar
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Progress Bar</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Progress:</strong> The <code>.tw-floating-notification-progress</code> wrapper is hidden by default
and becomes visible when it contains child content. Nest a <code>.progress</code> / <code>.progress-bar</code>
component inside for determinate or indeterminate states.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<!-- Determinate progress -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-cloud-arrow-up"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Uploading documents...</p>
<p class="tw-floating-notification-message">3 of 5 files uploaded</p>
<div class="tw-floating-notification-progress">
<div class="tw-progress" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
<div class="tw-progress-bar tw-progress-bar-primary" style="width: 60%"></div>
</div>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Indeterminate progress -->
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-cloud-arrow-up"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Processing upload...</p>
<p class="tw-floating-notification-message">Please wait while we process your files</p>
<div class="tw-floating-notification-progress">
<div class="tw-progress tw-progress-indeterminate" role="progressbar">
<div class="tw-progress-bar tw-progress-bar-primary"></div>
</div>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification-progress"><br>
  <div class="tw-progress" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"><br>
    <div class="tw-progress-bar tw-progress-bar-primary" style="width: 60%"></div><br>
  </div><br>
</div></code>
<br><br>
<em>Use <code>.progress-indeterminate</code> for unknown completion (e.g., processing uploads).</em>
</div>
</div>
<!-- ============================================
Section 7: Stacked Notifications
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Stacked Notifications</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Stacking:</strong> Multiple notifications stack vertically with a <code>gap-3</code> gap
inside the <code>.tw-floating-notification-container</code>. Newest notifications appear at the top.
This static example simulates the stacking layout without fixed positioning.
</p>
</div>
<div class="tw:flex tw:flex-col tw:gap-3" class="tw:max-w-[360px]">
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Changes saved</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">2 new applications received</p>
<p class="tw-floating-notification-message">Applications from Oliver Smith and Amelia Brown are ready for review.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon tw:text-orange-600">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Session expiring soon</p>
<p class="tw-floating-notification-message">Your session will expire in 5 minutes. Save your work.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Extend session</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
</div>
<!-- ============================================
Section 8: Interactive Demo
============================================ -->
<div class="tw:border-t tw:pt-6">
<h2 class="tw-h4 tw:mb-4">Interactive Demo</h2>
<div class="tw-callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Live:</strong> These notifications use <code>data-controller="floating-notification"</code>
for real slide-in animation and auto-dismiss. They are positioned inside a relative container for this demo
instead of the fixed top-right position used in production.
Hover over a notification to pause its auto-dismiss timer.
</p>
</div>
<div data-controller="floating-notification"
class="tw:relative tw:overflow-hidden tw:rounded-lg tw:bg-neutral-100 tw:p-4"
class="tw:min-h-[280px]">
<!-- Demo container replaces fixed positioning for preview context -->
<div class="tw:flex tw:flex-col tw:gap-3 tw:items-end">
<div class="tw-floating-notification"
data-floating-notification-target="notification"
data-auto-dismiss="0"
role="status">
<div class="tw-floating-notification-icon tw:text-green-600">
<i class="fa-solid fa-circle-check"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Settings updated</p>
<p class="tw-floating-notification-message">Your notification preferences have been saved.</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close"
data-action="click->floating-notification#dismiss">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification"
data-floating-notification-target="notification"
data-auto-dismiss="0"
role="status">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Report generated</p>
<p class="tw-floating-notification-message">Admissions summary for Term 1 is ready.</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Download</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button"
data-action="click->floating-notification#dismiss">Dismiss</button>
</div>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close"
data-action="click->floating-notification#dismiss">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="tw-floating-notification"
data-floating-notification-target="notification"
data-auto-dismiss="0"
role="status">
<div class="tw-floating-notification-icon tw:text-orange-600">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">3 applications pending review</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close"
data-action="click->floating-notification#dismiss">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
</div>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div class="tw-floating-notification-container"<br>
     data-controller="floating-notification"<br>
     role="status" aria-live="polite"><br>
  <div class="tw-floating-notification"<br>
       data-floating-notification-target="notification"><br>
    <div class="tw-floating-notification-icon">...</div><br>
    <div class="tw-floating-notification-content"><br>
      <p class="tw-floating-notification-title">Title</p><br>
      <p class="tw-floating-notification-message">Message</p><br>
    </div><br>
    <button class="tw-floating-notification-close"<br>
            data-action="click->floating-notification#dismiss"<br>
            aria-label="Close">...</button><br>
  </div><br>
</div></code>
<br><br>
<strong>Auto-dismiss:</strong> Default 4s | With actions 7s | <code>data-auto-dismiss="0"</code> to disable | <code>data-auto-dismiss="10000"</code> for custom duration
</div>
</div>
</div>