tgrj / tweb_adapter_tomselect
Tom Select implementation into tweb framework
Requires
- php: ^7.0|^8.0
This package is auto-updated.
Last update: 2026-04-19 21:27:37 UTC
README
Tom Select implementation into tweb framework
About
I wanted to have a multi select in my UI. So I did some research and Tom Select seemed the easiest to me so far. Then I thought about how to implement it on my site without the need of rewriting HTML and Javascript all over again.
So I came up with this little "helper" modul, which will generate HTML together with Javascript so that it is easy in a PHTML file to put a single or multi select on the page.
This modul also includes a style for Tom Select, when used with Tailwind. It should be used in the style building step and thus included in the main.js e.g. with import.
Usage
The composer install should copy the base "skeleton" CSS to the folder src/assets/css/tomselect_tailwind.css, which you can modify further. It should be roughly based on tht daisyUI semantic coloring. Pre-defined there are ts-dark (default) and ts-light "themes" for the select UI elements. INFO: NOPE, on my end it does not work with the post-update-cmd to make the module copy the tomselect_tailwind.css from the moduls src/ folder to the project folder ... you might consider doing this manually ... sorry, Mr Noob coding here! :D
Inside PHP / PHTML you can use the PHP function tweb_component_select(). See the source code or the doc string (provided by your IDE hopefully) for further info about the available parameters.
To get the values from the UI elements, use them as if they were standard select elements. E.g. like putting them into a form and doing a POST submit or so.