diff --git a/docs/form.md b/docs/form.md index 8862e6b..43b625f 100644 --- a/docs/form.md +++ b/docs/form.md @@ -11,7 +11,13 @@
- + +
+
+ +
+
+
@enddemo @@ -107,3 +113,62 @@ @endverbatim +## Radios + +@demo +
+ +
+
+ +
+
+ +
+@enddemo + +@verbatim + +```blade +
+ +
+
+ +
+
+ +
+``` + +@endverbatim + +## Inline Radios + +@demo +
+ +
+
+ +
+
+ +
+@enddemo + +@verbatim + +```blade +
+ +
+
+ +
+
+ +
+``` + +@endverbatim diff --git a/src/Providers/BladeServiceProvider.php b/src/Providers/BladeServiceProvider.php index d5add6c..fc68309 100644 --- a/src/Providers/BladeServiceProvider.php +++ b/src/Providers/BladeServiceProvider.php @@ -79,5 +79,6 @@ public function bootComponents(): void Blade::component($prefix . 'page.header', Components\Pages\Header::class); Blade::component($prefix . 'form.textarea', Components\Forms\Inputs\Textarea::class); Blade::component($prefix . 'form.select', Components\Forms\Inputs\Select::class); + Blade::component($prefix . 'form.radio', Components\Forms\Inputs\Radio::class); } } diff --git a/src/View/Components/Forms/Inputs/Radio.php b/src/View/Components/Forms/Inputs/Radio.php new file mode 100644 index 0000000..2946782 --- /dev/null +++ b/src/View/Components/Forms/Inputs/Radio.php @@ -0,0 +1,53 @@ +uuid = '-' . str(serialize($this)) + ->pipe('md5') + ->limit(5, '') + ->toString(); + } + + public function render(): string|View + { + return <<<'HTML' + @if($label) + $attributes->has('required')])> + {{ str($label)->lower()->ucfirst() }} + + @endif + @foreach($values as $key => $value) + + @endforeach + + + HTML; + } +}