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
<form action="/view-components/rails-app/action_menu/form_action.html" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="cvKgeUvqpCiMneQXzd46LrojSE0FVy0IQdLxsiaOVvJWco_PCVchjaZXZfjt7xZUWhdHhUqJPEFT5FvdJ0pYWg" autocomplete="off" /> <div class="FormControl-spacingWrapper"> <div data-view-component="true"> <div class="FormControl width-full FormControl--fullWidth"> <label class="FormControl-label" for="city"> Favorite city </label> <action-menu aria-describedby="validation-13808af2-b0ca-4be7-a9e0-697fe244b49f caption-13808af2-b0ca-4be7-a9e0-697fe244b49f" data-select-variant="single" data-dynamic-label="" data-view-component="true"> <focus-group direction="vertical" mnemonics retain> <button id="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-button" popovertarget="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-overlay" aria-controls="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-list" aria-haspopup="true" type="button" data-view-component="true" class="Button--secondary Button--medium Button"> <span class="Button-content"> <span class="Button-label">Select...</span> </span> </button> <anchored-position id="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-overlay" anchor="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-button" align="start" side="outside-bottom" anchor-offset="normal" popover="auto" data-view-component="true"> <div data-view-component="true" class="Overlay Overlay--size-auto"> <div data-view-component="true" class="Overlay-body Overlay-body--paddingNone"> <action-list> <div data-view-component="true"> <span data-list-inputs="true"> <input autocomplete="off" type="hidden" name="city" /> </span> <ul aria-labelledby="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-button" id="action-menu-4a88f663-1525-418b-8c77-230fdab18d8c-list" role="menu" data-view-component="true" class="ActionListWrap--inset ActionListWrap"> <li data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <button tabindex="-1" data-value="lopez_island" id="item-cd2c393d-1663-4b81-8feb-fec382e0ceef" type="button" role="menuitemradio" aria-checked="false" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-action--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check ActionListItem-singleSelectCheckmark"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </span> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-log"> <path d="M5 8.25a.75.75 0 0 1 .75-.75h4a.75.75 0 0 1 0 1.5h-4A.75.75 0 0 1 5 8.25ZM4 10.5A.75.75 0 0 0 4 12h4a.75.75 0 0 0 0-1.5H4Z"></path><path d="M13-.005c1.654 0 3 1.328 3 3 0 .982-.338 1.933-.783 2.818-.443.879-1.028 1.758-1.582 2.588l-.011.017c-.568.853-1.104 1.659-1.501 2.446-.398.789-.623 1.494-.623 2.136a1.5 1.5 0 1 0 2.333-1.248.75.75 0 0 1 .834-1.246A3 3 0 0 1 13 16H3a3 3 0 0 1-3-3c0-1.582.891-3.135 1.777-4.506.209-.322.418-.637.623-.946.473-.709.923-1.386 1.287-2.048H2.51c-.576 0-1.381-.133-1.907-.783A2.68 2.68 0 0 1 0 2.995a3 3 0 0 1 3-3Zm0 1.5a1.5 1.5 0 0 0-1.5 1.5c0 .476.223.834.667 1.132A.75.75 0 0 1 11.75 5.5H5.368c-.467 1.003-1.141 2.015-1.773 2.963-.192.289-.381.571-.558.845C2.13 10.711 1.5 11.916 1.5 13A1.5 1.5 0 0 0 3 14.5h7.401A2.989 2.989 0 0 1 10 13c0-.979.338-1.928.784-2.812.441-.874 1.023-1.748 1.575-2.576l.017-.026c.568-.853 1.103-1.658 1.501-2.448.398-.79.623-1.497.623-2.143 0-.838-.669-1.5-1.5-1.5Zm-10 0a1.5 1.5 0 0 0-1.5 1.5c0 .321.1.569.27.778.097.12.325.227.74.227h7.674A2.737 2.737 0 0 1 10 2.995c0-.546.146-1.059.401-1.5Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Lopez Island </span> </button> </li> <li data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <button tabindex="-1" data-value="bellevue" id="item-3d11f218-7a60-44be-8dd6-f045ce08e0fc" type="button" role="menuitemradio" aria-checked="false" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-action--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check ActionListItem-singleSelectCheckmark"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </span> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-paste"> <path d="M3.626 3.533a.249.249 0 0 0-.126.217v9.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-9.5a.249.249 0 0 0-.126-.217.75.75 0 0 1 .752-1.298c.541.313.874.89.874 1.515v9.5A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-9.5c0-.625.333-1.202.874-1.515a.75.75 0 0 1 .752 1.298ZM5.75 1h4.5a.75.75 0 0 1 .75.75v3a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 4.75v-3A.75.75 0 0 1 5.75 1Zm.75 3h3V2.5h-3Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Bellevue </span> </button> </li> <li data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <button tabindex="-1" data-value="seattle" id="item-bcf45f0f-01b6-4f39-9065-6dffb8ed81c6" type="button" role="menuitemradio" aria-checked="false" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-action--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check ActionListItem-singleSelectCheckmark"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </span> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-camera"> <path d="M15 3c.55 0 1 .45 1 1v9c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1 0-.55.45-1 1-1h4c.55 0 1 .45 1 1Zm-4.5 9c1.94 0 3.5-1.56 3.5-3.5S12.44 5 10.5 5 7 6.56 7 8.5 8.56 12 10.5 12ZM13 8.5c0 1.38-1.13 2.5-2.5 2.5S8 9.87 8 8.5 9.13 6 10.5 6 13 7.13 13 8.5ZM6 5V4H2v1Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Seattle </span> </button> </li> </ul> </div> </action-list> </div> </div> </anchored-position> </focus-group> </action-menu> <div class="FormControl-inlineValidation" id="validation-13808af2-b0ca-4be7-a9e0-697fe244b49f" hidden="hidden"> <span class="FormControl-inlineValidation--visual" data-target="" hidden><svg aria-hidden="true" height="12" viewBox="0 0 12 12" version="1.1" width="12" data-view-component="true" class="octicon octicon-check-circle-fill"> <path d="M6 0a6 6 0 1 1 0 12A6 6 0 0 1 6 0Zm-.705 8.737L9.63 4.403 8.392 3.166 5.295 6.263l-1.7-1.702L2.356 5.8l2.938 2.938Z"></path> </svg></span> <span class=" FormControl-inlineValidation--visual" data-target=""><svg aria-hidden="true" height="12" viewBox="0 0 12 12" version="1.1" width="12" data-view-component="true" class="octicon octicon-alert-fill"> <path d="M4.855.708c.5-.896 1.79-.896 2.29 0l4.675 8.351a1.312 1.312 0 0 1-1.146 1.954H1.33A1.313 1.313 0 0 1 .183 9.058ZM7 7V3H5v4Zm-1 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path> </svg></span> <span></span> </div> <span class="FormControl-caption" id="caption-13808af2-b0ca-4be7-a9e0-697fe244b49f">Select your favorite!</span> </div> </div> <div data-view-component="true"> <button name="submit" value="Submit" data-disable-with="Submit" type="submit" data-view-component="true" class="FormField-input flex-self-start Button--secondary Button--medium Button"> <span class="Button-content"> <span class="Button-label">Submit</span> </span> </button> </div> </div></form>
1
2
3
<%= primer_form_with(url: action_menu_form_action_path(format: route_format)) do |f| %> <%= render(ActionMenuForm.new(f)) %><% end %>
No notes provided.
No params configured.
app/forms/action_menu_form.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true# :nodoc:class ActionMenuForm < ApplicationForm form do |action_menu_form| action_menu_form.action_menu(name: "city", label: "Favorite city", caption: "Select your favorite!") do |city_list| city_list.with_item(label: "Lopez Island", data: { value: "lopez_island" }) do |item| item.with_leading_visual_icon(icon: :log) end city_list.with_item(label: "Bellevue", data: { value: "bellevue" }) do |item| item.with_leading_visual_icon(icon: :paste) end city_list.with_item(label: "Seattle", data: { value: "seattle" }) do |item| item.with_leading_visual_icon(icon: :"device-camera") end end action_menu_form.submit(name: :submit, label: "Submit") endend