Code Monkey home page Code Monkey logo

x-selectpicker's Introduction

X-Selectpicker

X-Selectpicker is a simple selectpicker using the wonderful Alpine.js

Install

Add the following script to the end of your <head> section.

<script src="https://cdn.jsdelivr.net/gh/intellow/x-selectpicker/dist/x-selectpicker.js" defer></script>

Make sure you have also installed Alpine.js as well.

Usage

Add the class x-selectpicker to any select element. Then you can fully customize the look and feel of your selectpicker by adding CSS classes to three HTML elements: the result div, the dropdown div, and each individual option div.

In this example, I'm using Tailwind CSS to style my selectpicker:

<select id="people" class="x-selectpicker" placeholder="Choose a Name"
        result-class="cursor-pointer p-2 pl-4 border-2 rounded"
        dropdown-class="z-10 w-auto bg-white border border-gray-400 absolute inline-block max-w-2xl"
        option-class="px-4 py-3 cursor-pointer hover:bg-blue-100 border-b border-gray-200"
        search="true"
        search-class="pl-4 py-3 focus:outline-none text-xl border-b-4 border-blue-500"
        >
    <option value="1">Kevin</option>
    <option value="2">Ruth</option>
    <option value="3">Caleb</option>
    <option value="4">Grant</option>
    <option value="5">Clarke</option>
</select>

x-selectpicker-in-action

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

x-selectpicker's People

Contributors

intellow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

x-selectpicker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.