Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e7e34e

Browse filesBrowse files
author
Daniel Wiser
committed
Add placeholder to select input
1 parent 3d4df61 commit 4e7e34e
Copy full SHA for 4e7e34e

File tree

Expand file treeCollapse file tree

2 files changed

+10
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-2
lines changed

‎src/Components/Form/Select.php

Copy file name to clipboardExpand all lines: src/Components/Form/Select.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class Select extends Component
2525
* @var string
2626
*/
2727
public $label;
28+
/**
29+
* The selectable options.
30+
*
31+
* @var string
32+
*/
33+
public $placeholder;
2834
/**
2935
* The selectable options.
3036
*
@@ -37,15 +43,17 @@ class Select extends Component
3743
*
3844
* @param string $name
3945
* @param string $label
46+
* @param string $placeholder
4047
* @param array $options
4148
*
4249
* @return void
4350
*/
44-
public function __construct($name = "select", $label = "Select Input", array $options = [])
51+
public function __construct(string $name = "select", string $label = "Select Input", string $placeholder = "Select Option...", array $options = [])
4552
{
4653
$this->id = 'input-' . Str::kebab(class_basename(get_class($this))) . '-' . md5($name);
4754
$this->name = $name;
4855
$this->label = $label;
56+
$this->placeholder = $placeholder;
4957
$this->options = $options;
5058
}
5159

‎src/Views/form/select.blade.php

Copy file name to clipboardExpand all lines: src/Views/form/select.blade.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div {{ $attributes->merge(['class' => 'form-group']) }}>
22
<label class="form-label">{{ $label }}</label>
33
<select name={{$name}} id={{$id}} class="form-select">
4-
<option>Click to select...</option>
4+
<option>{{ $placeholder }}</option>
55
@foreach($options as $value=>$option)
66
<option value="{{ $value }}">{{ $option }}</option>
77
@endforeach

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.