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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<div class="space-y-12"> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Single Checkbox</h3> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> I accept the terms and conditions </label> <div class="flex items-center mb-2"> <input type="checkbox" id="terms" name="terms" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600" aria-labelledby="terms_label" > <label id="terms_label" for="terms" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> I accept the terms and conditions </label> </div> <span id="" class="mt-1 text-xs text-gray-500 dark:text-gray-400"> Please read our terms and conditions </span></div> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Horizontal Checkbox Group</h3> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox group" data-controller="rapidrailsui--select-all" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Select technologies </label> <div class="flex items-center mb-2"> <input type="checkbox" id="select-all" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 select-all-checkbox" data-rapidrailsui--select-all-target="selectAll" data-action="change->rapidrailsui--select-all#toggleAll"> <label for="select-all" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Select All </label> </div> <div class="flex flex-row gap-2"> <input type="hidden" name="[technologies][]" value="" autocomplete="off"> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Ruby" name="[technologies][]" value="Ruby" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Ruby_label" > <label id="technologies_technologies_Ruby_label" for="technologies_technologies_Ruby" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Ruby </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Rails" name="[technologies][]" value="Rails" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Rails_label" > <label id="technologies_technologies_Rails_label" for="technologies_technologies_Rails" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Rails </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Stimulus JS" name="[technologies][]" value="Stimulus JS" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Stimulus JS_label" > <label id="technologies_technologies_Stimulus JS_label" for="technologies_technologies_Stimulus JS" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Stimulus Js </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Turbo" name="[technologies][]" value="Turbo" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Turbo_label" > <label id="technologies_technologies_Turbo_label" for="technologies_technologies_Turbo" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Turbo </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_LLM" name="[technologies][]" value="LLM" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_LLM_label" > <label id="technologies_technologies_LLM_label" for="technologies_technologies_LLM" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Llm </label> </div> </div> <span id="" class="mt-1 text-xs text-gray-500 dark:text-gray-400"> Choose one or more technologies </span></div> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Vertical Checkbox Group</h3> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox group" data-controller="rapidrailsui--select-all" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Select technologies </label> <div class="flex items-center mb-2"> <input type="checkbox" id="select-all" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 select-all-checkbox" data-rapidrailsui--select-all-target="selectAll" data-action="change->rapidrailsui--select-all#toggleAll"> <label for="select-all" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Select All </label> </div> <div class="flex flex-col gap-1"> <input type="hidden" name="[technologies][]" value="" autocomplete="off"> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Ruby" name="[technologies][]" value="Ruby" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Ruby_label" > <label id="technologies_technologies_Ruby_label" for="technologies_technologies_Ruby" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Ruby </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Rails" name="[technologies][]" value="Rails" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Rails_label" > <label id="technologies_technologies_Rails_label" for="technologies_technologies_Rails" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Rails </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Stimulus JS" name="[technologies][]" value="Stimulus JS" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Stimulus JS_label" > <label id="technologies_technologies_Stimulus JS_label" for="technologies_technologies_Stimulus JS" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Stimulus Js </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_Turbo" name="[technologies][]" value="Turbo" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_Turbo_label" > <label id="technologies_technologies_Turbo_label" for="technologies_technologies_Turbo" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Turbo </label> </div> <div class="flex items-center mb-2"> <input type="checkbox" id="technologies_technologies_LLM" name="[technologies][]" value="LLM" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 item-checkbox" data-rapidrailsui--select-all-target="item" data-action="change->rapidrailsui--select-all#itemToggled" aria-labelledby="technologies_technologies_LLM_label" > <label id="technologies_technologies_LLM_label" for="technologies_technologies_LLM" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Llm </label> </div> </div> <span id="" class="mt-1 text-xs text-gray-500 dark:text-gray-400"> Choose one or more technologies </span></div> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Different Colors</h3> <div class="space-y-2"> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Default </label> <div class="flex items-center mb-2"> <input type="checkbox" id="default" name="default" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600" aria-labelledby="default_label" > <label id="default_label" for="default" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Default </label> </div> </div> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Primary </label> <div class="flex items-center mb-2"> <input type="checkbox" id="primary" name="primary" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-primary-600 focus:ring-primary-500 dark:focus:ring-primary-600 border-primary-600" aria-labelledby="primary_label" > <label id="primary_label" for="primary" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Primary </label> </div> </div> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Secondary </label> <div class="flex items-center mb-2"> <input type="checkbox" id="secondary" name="secondary" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-secondary-600 focus:ring-secondary-500 dark:focus:ring-secondary-600 border-secondary-600" aria-labelledby="secondary_label" > <label id="secondary_label" for="secondary" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Secondary </label> </div> </div> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Info </label> <div class="flex items-center mb-2"> <input type="checkbox" id="info" name="info" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-sky-600 focus:ring-sky-500 dark:focus:ring-sky-600 border-sky-600" aria-labelledby="info_label" > <label id="info_label" for="info" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Info </label> </div> </div> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Success </label> <div class="flex items-center mb-2"> <input type="checkbox" id="success" name="success" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-emerald-600 focus:ring-emerald-500 dark:focus:ring-emerald-600 border-emerald-600" aria-labelledby="success_label" > <label id="success_label" for="success" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Success </label> </div> </div> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Warning </label> <div class="flex items-center mb-2"> <input type="checkbox" id="warning" name="warning" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-orange-600 focus:ring-orange-500 dark:focus:ring-orange-600 border-orange-600" aria-labelledby="warning_label" > <label id="warning_label" for="warning" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Warning </label> </div> </div> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Danger </label> <div class="flex items-center mb-2"> <input type="checkbox" id="danger" name="danger" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-rose-600 focus:ring-rose-500 dark:focus:ring-rose-600 border-rose-600" aria-labelledby="danger_label" > <label id="danger_label" for="danger" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Danger </label> </div> </div> </div> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Disabled State</h3> <!-- app/components/rapidrailsui/checkbox/component.html.erb --> <div role="checkbox" class=""> <label id="" class="block mb-2 text-base font-medium text-gray-900 dark:text-white"> Disabled checkbox </label> <div class="flex items-center mb-2"> <input type="checkbox" id="disabled" name="disabled" value="1" class="w-4 h-4 bg-gray-100 border-gray-300 rounded focus:ring-2 dark:bg-gray-700 dark:border-gray-600 text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600 cursor-not-allowed opacity-50" aria-labelledby="disabled_label" disabled> <label id="disabled_label" for="disabled" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"> Disabled checkbox </label> </div> </div> </div></div>
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
<div class="space-y-12"> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Single Checkbox</h3> <%= rui_checkbox(method: :terms, label: "I accept the terms and conditions", help_text: "Please read our terms and conditions") %> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Horizontal Checkbox Group</h3> <%= rui_checkbox(method: :technologies, collection: technologies, label: "Select technologies", help_text: "Choose one or more technologies", select_all: true, layout: :horizontal) %> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Vertical Checkbox Group</h3> <%= rui_checkbox(method: :technologies, collection: technologies, label: "Select technologies", help_text: "Choose one or more technologies", select_all: true, layout: :vertical) %> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Different Colors</h3> <div class="space-y-2"> <% [:default, :primary, :secondary, :info, :success, :warning, :danger].each do |color| %> <%= rui_checkbox(method: color, label: color.to_s.capitalize, color: color) %> <% end %> </div> </div> <div class="p-4 rounded border"> <h3 class="mb-2 text-lg font-semibold text-gray-800 dark:text-gray-200">Disabled State</h3> <%= rui_checkbox(method: :disabled, label: "Disabled checkbox", disabled: true) %> </div></div>
๐ Checkbox Component Overview
This preview showcases various types of checkboxes:
โ Single checkbox ๐ Checkbox group ๐ Different colors ๐ Disabled state ๐ With labels and help text ๐ Select all functionality
Each checkbox demonstrates:
- Different styles and colors
- Various customization options
- Integration with form builders
How to use: <%= f.rui_checkbox(method: :terms_accepted, label: "I accept the terms") %>
For customization options, check out the 'Playground' section below! ๐๏ธ
No params configured.