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
<div class="midwest-accordion"> <details name="accordion-101a8" class="midwest-accordion-item" open="open"> <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. </div> </details> <details name="accordion-101a8" 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, run <code>bundle install</code>, then import the stylesheet and JavaScript. </div> </details> <details name="accordion-101a8" 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. </div> </details></div>1
2
3
4
5
6
7
8
9
10
11
12
<%= midwest_accordion(variant: params[:variant]&.to_sym || :default) do |a| %> <% a.with_item("What is Midwest?", open: true) do %> Midwest is a ViewComponent-based design system for Ruby on Rails applications. <% end %> <% a.with_item("How do I install it?") do %> Add <code>gem "midwest"</code> to your Gemfile, run <code>bundle install</code>, then import the stylesheet and JavaScript. <% end %> <% a.with_item("Is it accessible?") do %> Yes — the accordion uses native <code><details></code> and <code><summary></code> elements. <% end %><% end %>Playground
| Param | Description | Input |
|---|---|---|
|
— |
|
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Accordion/playground
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."