Skip to content

Commit

Permalink
Add * for required fields on labels
Browse files Browse the repository at this point in the history
  • Loading branch information
techenby committed May 14, 2024
1 parent 072ded8 commit 5ffa4b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion resources/views/components/form/label.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@props(['value'])
@props(['value', 'required' => false])

<label {{ $attributes->merge(['class' => 'block font-medium text-sm text-gray-700 dark:text-gray-300']) }}>
{{ $value ?? $slot }}

@if ($required)
<span>*</span>
@endif
</label>
16 changes: 8 additions & 8 deletions resources/views/tricks/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
<x-container>
<x-form method="POST" action="{{ route('tricks.store') }}">
<div>
<x-form.label for="name" :value="__('Name')" />
<x-form.input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus />
<x-form.label for="name" :value="__('Name')" required/>
<x-form.input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" autofocus />
<x-form.error :messages="$errors->get('name')" class="mt-2" />
</div>

<div>
<x-form.label for="description" :value="__('Description')" />
<x-form.textarea id="description" class="block mt-1 w-full" name="description" :value="old('description')" required />
<x-form.label for="description" :value="__('Description')" required/>
<x-form.textarea id="description" class="block mt-1 w-full" name="description" :value="old('description')" />
<x-form.error :messages="$errors->get('description')" class="mt-2" />
</div>

<div>
<x-form.label for="code" :value="__('Code')" />
<x-form.textarea id="code" class="block mt-1 w-full" name="code" :value="old('code')" required />
<x-form.label for="code" :value="__('Code')" required />
<x-form.textarea id="code" class="block mt-1 w-full" name="code" :value="old('code')" />
<x-form.error :messages="$errors->get('code')" class="mt-2" />
</div>

<div>
<x-form.label for="tags" :value="__('Tags')" />
<x-form.tags id="tags" class="block mt-1 w-full" name="tags" :options="$tagOptions" :value="old('tags')" required />
<x-form.label for="tags" :value="__('Tags')" required />
<x-form.tags id="tags" class="block mt-1 w-full" name="tags" :options="$tagOptions" :value="old('tags')" />
<x-form.error :messages="$errors->get('tags')" class="mt-2" />
</div>

Expand Down

0 comments on commit 5ffa4b5

Please sign in to comment.