Skip to content

Commit ba9f65e

Browse files
committed
Form blade and single checkbox label and desc
1 parent d178f4f commit ba9f65e

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

resources/views/components/cds/checkbox.blade.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
'label', // group label OR single checkbox label
33
'name' => $attributes->whereStartsWith('wire:model')->first(),
44
'options' => null, // if array → group mode; if null → single mode
5+
'value' => null,
6+
'text' => null,
57
'badge' => null,
68
])
79

810
@php
911
$badge ??= $attributes->whereStartsWith('required')->isNotEmpty() ? 'Required' : null;
12+
$text ??= $value;
1013
@endphp
1114

1215
{{-- Group Mode (options array is passed) --}}
@@ -22,11 +25,10 @@
2225

2326
{{-- Single Checkbox Mode --}}
2427
@else
25-
<flux:field variant="inline">
26-
<flux:checkbox :$attributes />
27-
28-
<flux:label :$badge>{{ $label }}</flux:label>
29-
30-
<flux:error :$name />
31-
</flux:field>
28+
<flux:checkbox.group :$label :$badge :$attributes >
29+
<flux:checkbox
30+
:value="$value"
31+
:label="$text"
32+
/>
33+
</flux:checkbox.group>
3234
@endif

resources/views/examples/form.blade.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
</div>
1515
</div>
16-
<div class="region padded-small tint">
16+
<div class="region padded tint">
1717
<div class="container container-full">
1818
<div class="section">
1919
<h2>Basic Text</h2>
@@ -101,7 +101,9 @@ class="native-size"
101101
<form>
102102
<x-cds.checkbox
103103
name="terms"
104-
label="I agree to the terms and conditions"
104+
label="Terms and Conditions"
105+
description="Please review our terms and conditions before proceeding."
106+
value="I agree to the terms and conditions"
105107
required
106108
error:message="This field has an error."
107109

@@ -139,6 +141,8 @@ class="native-size"
139141
error:message="This field has an error."
140142

141143
/>
144+
<flux:separator class="mb-4" />
145+
142146
<x-cds.button type="submit">Submit</x-cds.button>
143147
<x-cds.button type="reset">Reset</x-cds.button>
144148
</form>

0 commit comments

Comments
 (0)