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
<div data-controller="midwest-page-transition" data-midwest-page-transition-style-value="slide-left" data-midwest-page-transition-duration-value="var(--duration-slow)" data-midwest-page-transition-easing-value="var(--ease-emphasized)" aria-hidden="true" class="midwest-page-transition"></div><div class="p-6 space-y-4 max-w-lg overflow-hidden"> <div id="pt-slide-a"> <div class="space-y-4"> <div class="midwest-steps" role="tablist" aria-label="Progress steps"> <div class="midwest-step current"> <button class="step-button" role="tab" aria-selected="true" aria-current="step" type="button"> <span class="copy">Account</span> </button></div> <div class="midwest-step"> <button class="step-button" role="tab" aria-selected="false" type="button"> <span class="copy">Preferences</span> </button></div> <div class="midwest-step"> <button class="step-button" role="tab" aria-selected="false" type="button"> <span class="copy">Confirm</span> </button></div> </div> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-semibold mb-1">Account details</p> <p class="text-sm text-theme-7 mb-4">Enter your name and email to get started. The next step slides in from the right.</p> <a class="midwest-button variant-ghost size-small disabled theme-primary" name="button" disabled="disabled" href="/"> <span class="midwest-button-content">Next step →</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> </a> </section> </div> </article> </div> </div> <div id="pt-slide-b" style="display:none"> <div class="space-y-4"> <div class="midwest-steps" role="tablist" aria-label="Progress steps"> <div class="midwest-step complete"> <button class="step-button" role="tab" aria-selected="false" type="button"> <div class="midwest-icon " aria-hidden="true"> <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"><title>Checkmark</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M416 128L192 384l-96-96"></path></svg> </div> </div> <span class="copy">Account</span> </button></div> <div class="midwest-step current"> <button class="step-button" role="tab" aria-selected="true" aria-current="step" type="button"> <span class="copy">Preferences</span> </button></div> <div class="midwest-step"> <button class="step-button" role="tab" aria-selected="false" type="button"> <span class="copy">Confirm</span> </button></div> </div> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-semibold mb-1">Preferences</p> <p class="text-sm text-theme-7 mb-4">The previous step slid out left — directional motion that communicates forward progress.</p> <a class="midwest-button variant-ghost size-small disabled theme-primary" name="button" disabled="disabled" href="/"> <span class="midwest-button-content">Next step →</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> </a> </section> </div> </article> </div> </div> <div class="flex items-center gap-3"> <button type="button" id="pt-slide-btn" class="midwest-button variant-default size-default theme-primary" name="button"> <span class="midwest-button-content">Next step →</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> <span id="pt-slide-no-support" class="text-sm text-theme-7" style="display:none"> View Transitions API not supported in this browser </span> </div> <pre class="text-xs bg-gray-100 rounded p-3"><%= midwest_page_transition(style: :slide, direction: :left) %></pre></div><script> (function () { var a = document.getElementById('pt-slide-a'); var b = document.getElementById('pt-slide-b'); var btn = document.getElementById('pt-slide-btn'); var noSupport = document.getElementById('pt-slide-no-support'); var fwd = 'Next step →'; var back = '← Previous step'; if (!document.startViewTransition) { btn.style.display = 'none'; noSupport.style.display = ''; return; } var showingA = true; btn.addEventListener('click', function () { document.startViewTransition(function () { a.style.display = showingA ? 'none' : ''; b.style.display = showingA ? '' : 'none'; showingA = !showingA; btn.querySelector('.midwest-button-content').textContent = showingA ? fwd : back; }); }); }());</script>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
<%= midwest_page_transition(style: :slide, direction: :left) %><% page_a = capture do %> <div class="space-y-4"> <%= midwest_steps do |s| %> <% s.with_step("Account", current: true) %> <% s.with_step("Preferences") %> <% s.with_step("Confirm") %> <% end %> <%= midwest_card do %> <p class="font-semibold mb-1">Account details</p> <p class="text-sm text-theme-7 mb-4">Enter your name and email to get started. The next step slides in from the right.</p> <%= midwest_button("Next step →", variant: :ghost, size: :small, disabled: true) %> <% end %> </div><% end %><% page_b = capture do %> <div class="space-y-4"> <%= midwest_steps do |s| %> <% s.with_step("Account", complete: true) %> <% s.with_step("Preferences", current: true) %> <% s.with_step("Confirm") %> <% end %> <%= midwest_card do %> <p class="font-semibold mb-1">Preferences</p> <p class="text-sm text-theme-7 mb-4">The previous step slid out left — directional motion that communicates forward progress.</p> <%= midwest_button("Next step →", variant: :ghost, size: :small, disabled: true) %> <% end %> </div><% end %><%= render 'elements/page_transition_component_preview/demo', id: 'slide', page_a: page_a, page_b: page_b, btn_forward: 'Next step →', btn_back: '← Previous step', code: '<%= midwest_page_transition(style: :slide, direction: :left) %>' %>Slide
Slide transition — the current page exits in the given direction and the next page enters from the opposite side. Useful for wizard flows or step-by-step sequences where directionality conveys progress.
No params configured.
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Page Transition/slide
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."