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
<form action="/foo" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="p8nMysx8rY8xrTOX-8sxWpoKOgREC-xsQSIMEq_BeSibDv6SPirVR0rfjpZ2OJWott6SCgImX0qYJ7t_0PR-rw" autocomplete="off" /> <div class="FormControl-spacingWrapper"> <div data-view-component="true"> <div class="FormControl-spacingWrapper"> <div data-view-component="true"> <primer-text-field class="FormControl width-full FormControl--fullWidth"> <label class="FormControl-label" for="_name_form_first_name"> First name <span aria-hidden="true">*</span> </label> <div class="FormControl-input-wrap"> <input aria-required="true" aria-describedby="validation-b1321f6e-0846-4a27-a66a-7147c7f9925e caption-b1321f6e-0846-4a27-a66a-7147c7f9925e" data-target="primer-text-field.inputElement " class="FormControl-input FormControl-medium" type="text" name="[name_form][first_name]" id="_name_form_first_name" /> </div> <div class="FormControl-inlineValidation" id="validation-b1321f6e-0846-4a27-a66a-7147c7f9925e" hidden="hidden"> <span class="FormControl-inlineValidation--visual" data-target="primer-text-field.validationSuccessIcon" 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="primer-text-field.validationErrorIcon"><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-b1321f6e-0846-4a27-a66a-7147c7f9925e">That which we call a rose by any other name would smell as sweet.</span> </primer-text-field> </div> <div class="border-top color-border-muted"></div> <div data-view-component="true"> <primer-text-field class="FormControl width-full FormControl--fullWidth"> <label class="FormControl-label" for="_name_form_last_name"> Last name <span aria-hidden="true">*</span> </label> <div class="FormControl-input-wrap"> <input aria-required="true" aria-describedby="validation-8ef23d35-9efa-4633-bdf3-44a05caf638c caption-8ef23d35-9efa-4633-bdf3-44a05caf638c" data-target="primer-text-field.inputElement " class="FormControl-input FormControl-medium" type="text" name="[name_form][last_name]" id="_name_form_last_name" /> </div> <div class="FormControl-inlineValidation" id="validation-8ef23d35-9efa-4633-bdf3-44a05caf638c" hidden="hidden"> <span class="FormControl-inlineValidation--visual" data-target="primer-text-field.validationSuccessIcon" 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="primer-text-field.validationErrorIcon"><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-8ef23d35-9efa-4633-bdf3-44a05caf638c">Bueller. Bueller. Bueller.</span> </primer-text-field> </div> <div data-view-component="true"> <input value="abc123" class="FormField-input" autocomplete="off" type="hidden" name="[name_form][csrf_token]" id="_name_form_csrf_token" /> </div> </div> </div> <div data-view-component="true"> <primer-text-field class="FormControl width-full FormControl--fullWidth"> <label class="FormControl-label" for="green"> I'm green </label> <div class="FormControl-input-wrap"> <input aria-describedby="validation-48a9bd67-bf2f-488f-83c0-e0234a808eb1" data-target="primer-text-field.inputElement " class="FormControl-input FormControl-medium color-fg-success FormControl-input FormControl-medium" type="text" name="green" id="green" /> </div> <div class="FormControl-inlineValidation" id="validation-48a9bd67-bf2f-488f-83c0-e0234a808eb1" hidden="hidden"> <span class="FormControl-inlineValidation--visual" data-target="primer-text-field.validationSuccessIcon" 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="primer-text-field.validationErrorIcon"><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> </primer-text-field> </div> <div data-view-component="true" class="FormControl-horizontalGroup"> <button name="submit" value="Submit" data-disable-with="Submit" type="submit" disabled="disabled" data-view-component="true" class="FormField-input flex-self-start Button--primary Button--medium Button mb-3"> <span class="Button-content"> <span class="Button-visual Button-leadingVisual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check-circle"> <path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm1.5 0a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm10.28-1.72-4.5 4.5a.75.75 0 0 1-1.06 0l-2-2a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018l1.47 1.47 3.97-3.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </span> <span class="Button-label">Submit</span> </span> </button> <button name="button" type="button" data-view-component="true" class="FormField-input flex-self-start Button--secondary Button--medium Button mb-3"> <span class="Button-content"> <span class="Button-visual Button-leadingVisual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> </span> <span class="Button-label">Click me</span> </span> </button> </div> </div></form>
1
2
3
<%= primer_form_with(url: "/foo") do |f| %> <%= render(SubmitButtonForm.new(f)) %><% end %>
No notes provided.
No params configured.
app/forms/submit_button_form.rb
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
# frozen_string_literal: true# :nodoc:class SubmitButtonForm < ApplicationForm form do |my_form| my_form.fields_for(:name_form) do |builder| MultiTextFieldForm.new(builder) end my_form.text_field( name: :green, label: "I'm green", color: :success ) my_form.group(layout: :horizontal) do |button_group| button_group.submit(name: :submit, label: "Submit", scheme: :primary, mb: 3, disabled: true) do |component| component.with_leading_visual_icon(icon: :"check-circle") end button_group.button(name: :button, label: "Click me", mb: 3) do |component| component.with_leading_visual_icon(icon: :alert) end end endend