src/Concerns/Selection.php
public function datalist(string $id, array $list = []): Htmlable
    {
        $this->type = 'datalist';

        $attributes['id'] = $id;

        $html = [];

        if (Arr::isAssoc($list)) {
            foreach ($list as $value => $display) {
                $html[] = $this->option($display, $value, null, []);
            }
        } else {
            foreach ($list as $value) {
                $html[] = $this->option($value, $value, null, []);
            }
        }

        $attributes = $this->getHtmlBuilder()->attributes($attributes);

        $list = \implode('', $html);

        return $this->toHtmlString("<datalist{$attributes}>{$list}</datalist>");
    }
public function datalist(string $id, array $list = []): Htmlable
    {
        $this->type = 'datalist';

        $attributes['id'] = $id;

        $html = [];

        if (Arr::isAssoc($list)) {
            foreach ($list as $value => $display) {
                $html[] = $this->option($display, $value, null, []);
            }
        } else {
            foreach ($list as $value) {
                $html[] = $this->option($value, $value, null, []);
            }
        }

        $attributes = $this->getHtmlBuilder()->attributes($attributes);

        $list = \implode('', $html);

        return $this->toHtmlString("<datalist{$attributes}>{$list}</datalist>");
    }
Create a datalist box field.

@param  string $id
@param  array  $list

@return \Illuminate\Contracts\Support\Htmlable