Skip to content

Commit

Permalink
feat(doc) Ajustes exemplo de radios
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamagawa committed Feb 20, 2024
1 parent 8cd7795 commit deb945d
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
108 changes: 108 additions & 0 deletions docs/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,114 @@

@endverbatim

## Radios

@demo
<div class="mb-3">
<x-form.group label="Radios">
<x-form.radio name="radio2" label="Option 01" value="option01"/>
<x-form.radio name="radio2" label="Option 02" value="option02"/>
<x-form.radio name="radio2" label="Option 03" value="option03" disabled/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios">
<x-form.radio name="radio2" label="Option 01" value="option01" required/>
<x-form.radio name="radio2" label="Option 02" value="option02" required/>
<x-form.radio name="radio2" label="Option 03" value="option03" required/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios">
<x-form.radio name="radio2" label="Option 01" value="option01"/>
<x-form.radio name="radio2" label="Option 02" value="option02"/>
<x-form.radio name="radio2" label="Option 03" value="option03" hint="Selecione uma opção"/>
</x-form.group>
</div>
@enddemo

@verbatim

```blade
<div class="mb-3">
<x-form.group label="Radios">
<x-form.radio name="radio2" label="Option 01" value="option01"/>
<x-form.radio name="radio2" label="Option 02" value="option02"/>
<x-form.radio name="radio2" label="Option 03" value="option03" disabled/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios">
<x-form.radio name="radio2" label="Option 01" value="option01" required/>
<x-form.radio name="radio2" label="Option 02" value="option02" required/>
<x-form.radio name="radio2" label="Option 03" value="option03" required/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios">
<x-form.radio name="radio2" label="Option 01" value="option01"/>
<x-form.radio name="radio2" label="Option 02" value="option02"/>
<x-form.radio name="radio2" label="Option 03" value="option03" hint="Selecione uma opção"/>
</x-form.group>
</div>
```

@endverbatim

## Inline Radios

@demo
<div class="mb-3">
<x-form.group label="Radios inline">
<x-form.radio name="radio2" label="Option 01" value="option01" inline/>
<x-form.radio name="radio2" label="Option 02" value="option02" inline/>
<x-form.radio name="radio2" label="Option 03" value="option03" inline disabled/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios inline">
<x-form.radio name="radio2" label="Option 01" value="option01" inline required/>
<x-form.radio name="radio2" label="Option 02" value="option02" inline required/>
<x-form.radio name="radio2" label="Option 03" value="option03" inline required/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios inline">
<x-form.radio name="radio2" label="Option 01" value="option01" inline/>
<x-form.radio name="radio2" label="Option 02" value="option02" inline/>
<x-form.radio name="radio2" label="Option 03" value="option03" hint="Selecione uma opção" inline/>
</x-form.group>
</div>
@enddemo

@verbatim

```blade
<div class="mb-3">
<x-form.group label="Radios inline">
<x-form.radio name="radio2" label="Option 01" value="option01" inline/>
<x-form.radio name="radio2" label="Option 02" value="option02" inline/>
<x-form.radio name="radio2" label="Option 03" value="option03" inline disabled/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios inline">
<x-form.radio name="radio2" label="Option 01" value="option01" inline required/>
<x-form.radio name="radio2" label="Option 02" value="option02" inline required/>
<x-form.radio name="radio2" label="Option 03" value="option03" inline required/>
</x-form.group>
</div>
<div class="mb-3">
<x-form.group label="Radios inline">
<x-form.radio name="radio2" label="Option 01" value="option01" inline/>
<x-form.radio name="radio2" label="Option 02" value="option02" inline/>
<x-form.radio name="radio2" label="Option 03" value="option03" hint="Selecione uma opção" inline/>
</x-form.group>
</div>
```

@endverbatim

## Checkboxes

@demo
Expand Down
3 changes: 3 additions & 0 deletions src/View/Components/Forms/Inputs/Radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Radio extends Component
public function __construct(
public string $name = '',
public string $label = '',
public string $hint = '',
public bool $inline = false,
) {
$this->uuid = '-' . str(serialize($this))
Expand Down Expand Up @@ -42,6 +43,8 @@ public function render(): string|View
<span class="form-check-label">{{ str($label)->lower()->ucfirst() }}</span>
@endif
</label>
<x-form.error field="{{ $name }}"/>
<x-form.hint message="{{ $hint }}"/>
HTML;
}
}

0 comments on commit deb945d

Please sign in to comment.