PHP code example of nickstarlight / live-select

1. Go to this page and download the library: Download nickstarlight/live-select library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nickstarlight / live-select example snippets


use LiveSelect\Traits\WithLiveSelect; // The LiveSelect trait ect; // Include the LiveSelect trait

    public $yourModel; // Create a model
    public $data = [
        [
            'id' => 1,
            'name' => 'Leroy Jenkins'
        ]
    ]; // Define your data
}

<div>
    <livewire:live-select
        :multi="false"                  // Multiselection mode                                         - Defaults to false 
        :search="true"                  // Allows the user to filter values on the dropdown            - Defaults to false
        :description="'Select a value'" // The input label                                             - Defaults to null
        :options="$data"                // The options that will be rendered on the dropdown           - Required
        :label="'name'"                 // The key/value pair to be used as the options label          - Optional, will assume 'label' if omitted
        :value="'id'"                   // The key/value pair to be used as the options value          - Optional, will assume 'value' if omitted
        :model="'yourModel'"            // Your parent component public variable name for data binding - Required
    >
</div>