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
<div class="midwest-accordion"> <details name="accordion-f538" class="midwest-accordion-item"> <summary class="accordion-trigger"> <span class="accordion-title">What is Midwest?</span> <span class="accordion-chevron" aria-hidden="true"> <div class="midwest-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="Chevron down"><title>Chevron down</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M112 184l144 144 144-144"></path></svg> </div> </div> </span> </summary> <div class="accordion-panel"> Midwest is a ViewComponent-based design system for Ruby on Rails applications. It provides accessible, composable UI primitives that integrate seamlessly with Tailwind CSS. </div> </details> <details name="accordion-f538" class="midwest-accordion-item"> <summary class="accordion-trigger"> <span class="accordion-title">How do I install it?</span> <span class="accordion-chevron" aria-hidden="true"> <div class="midwest-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="Chevron down"><title>Chevron down</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M112 184l144 144 144-144"></path></svg> </div> </div> </span> </summary> <div class="accordion-panel"> Add <code>gem "midwest"</code> to your Gemfile and run <code>bundle install</code>. Then import the stylesheet and JavaScript in your application. </div> </details> <details name="accordion-f538" class="midwest-accordion-item"> <summary class="accordion-trigger"> <span class="accordion-title">Is it accessible?</span> <span class="accordion-chevron" aria-hidden="true"> <div class="midwest-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="Chevron down"><title>Chevron down</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M112 184l144 144 144-144"></path></svg> </div> </div> </span> </summary> <div class="accordion-panel"> Yes. The accordion uses native <code><details></code> and <code><summary></code> elements, which provide keyboard navigation and screen reader support out of the box. </div> </details> <details name="accordion-f538" class="midwest-accordion-item" open="open"> <summary class="accordion-trigger"> <span class="accordion-title">Can I nest other components inside?</span> <span class="accordion-chevron" aria-hidden="true"> <div class="midwest-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="Chevron down"><title>Chevron down</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M112 184l144 144 144-144"></path></svg> </div> </div> </span> </summary> <div class="accordion-panel"> <div class="midwest-callout theme-primary"> <div class="callout-wrap"> Any component can be nested inside an accordion panel, including cards, forms, and other accordions. </div> </div> </div> </details></div>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<%= midwest_accordion do |a| %> <% a.with_item("What is Midwest?") do %> Midwest is a ViewComponent-based design system for Ruby on Rails applications. It provides accessible, composable UI primitives that integrate seamlessly with Tailwind CSS. <% end %> <% a.with_item("How do I install it?") do %> Add <code>gem "midwest"</code> to your Gemfile and run <code>bundle install</code>. Then import the stylesheet and JavaScript in your application. <% end %> <% a.with_item("Is it accessible?") do %> Yes. The accordion uses native <code><details></code> and <code><summary></code> elements, which provide keyboard navigation and screen reader support out of the box. <% end %> <% a.with_item("Can I nest other components inside?", open: true) do %> <%= midwest_callout("Absolutely.") do %> Any component can be nested inside an accordion panel, including cards, forms, and other accordions. <% end %> <% end %><% end %>Default
A basic accordion. Only one item can be open at a time via the native
HTML name attribute on each <details> element.
No params configured.
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Accordion/default
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."