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
<div role="status" aria-live="polite" aria-atomic="true" data-controller="midwest-notification" data-action="midwest-countdown-timer:complete->midwest-notification#close" class="midwest-notification animated theme-green"> <div class="midwest-notification__body"> <div class="midwest-icon midwest-notification__icon"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Checkmark circle"><title>Checkmark circle</title><path d="M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm108.25 138.29l-134.4 160a16 16 0 01-12 5.71h-.27a16 16 0 01-11.89-5.3l-57.6-64a16 16 0 1123.78-21.4l45.29 50.32 122.59-145.91a16 16 0 0124.5 20.58z"></path></svg> </div></div> <div class="midwest-notification__content"> <p class="midwest-notification__title">Saved!</p> <div class="midwest-notification__message"> This notification will dismiss itself in 5 seconds.</div> </div> </div> <button data-action="midwest-notification#close" class="midwest-button variant-default size-small pill contrast theme-primary" name="button"> <span class="midwest-button-content"> <span class="sr-only">Dismisses in 5 seconds</span> <div data-controller="midwest-countdown-timer" data-midwest-countdown-timer-seconds-value="5" style="--duration: 5s; --circumference: 69.115;" aria-hidden="true" class="midwest-countdown-timer"> <svg viewBox="0 0 28 28" width="1em" height="1em"> <circle class="midwest-countdown-timer__track" cx="14" cy="14" r="11" /> <circle class="midwest-countdown-timer__progress" cx="14" cy="14" r="11" stroke-dasharray="69.115" /> </svg></div></span><div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none"> <div class="midwest-loading-icon-inner"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --><svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true"> <circle cx="15" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="60" cy="15" r="9" fill-opacity="0.3"> <animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate> </circle> <circle cx="105" cy="15" r="15"> <animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate> <animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate> </circle></svg> </div></div></button></div>1
2
3
<%= midwest_notification(state: :success, title: 'Saved!', countdown: 5) do %> This notification will dismiss itself in 5 seconds.<% end %>Countdown
Pass a countdown: integer to auto-dismiss the notification after the
given number of seconds. The dismiss button is replaced with a
CountdownTimerComponent.
No params configured.
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Notification/countdown
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."