Skip to content

Instantly share code, notes, and snippets.

@cmer
Last active October 21, 2024 00:43
Show Gist options
  • Save cmer/4b750d921510bca27f003a20f0efb524 to your computer and use it in GitHub Desktop.
Save cmer/4b750d921510bca27f003a20f0efb524 to your computer and use it in GitHub Desktop.
Tom-Select.js Tailwind UI theme
Copyright 2023 Carl Mercier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
Use the following to reproduce a Tailwind UI Select field with Tom Select
*/
@import 'tom-select/dist/css/tom-select';
.ts-control {
@apply mt-2 w-full rounded-md border border-gray-300 py-1 px-3 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 h-9 sm:text-sm sm:leading-6;
}
.ts-control input {
@apply !pr-5 text-sm !m-0;
}
.ts-wrapper.plugin-remove_button .item {
@apply rounded-md;
}
.ts-wrapper.multi .ts-control > div {
@apply p-0 m-0 pl-1;
}
.ts-wrapper.plugin-remove_button .item .remove {
@apply border-none text-lg leading-none py-1 rounded-r-lg;
}
.ts-dropdown {
@apply rounded-md border border-solid border-t border-gray-300;
}
.ts-dropdown [data-selectable].option, .ts-dropdown .no-results {
@apply py-2;
}
.ts-dropdown [data-selectable].option:first-child {
@apply rounded-t-md;
}
.ts-dropdown [data-selectable].option:last-child {
@apply rounded-b-md;
}
.ts-dropdown .create:hover, .ts-dropdown .option:hover, .ts-dropdown .active {
@apply bg-indigo-100 text-indigo-900;
}
.ts-dropdown .spinner {
@apply h-auto w-auto;
}
.ts-dropdown .spinner:after {
@apply h-5 w-5 border-2 p-0 my-0 inline-block;
}
.ts-wrapper:not(.form-control):not(.form-select).single .ts-control {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
background-position: right 0.5rem center;
background-repeat: no-repeat;
background-size: 1.5em 1.5em;
print-color-adjust: exact;
}
@bdinhxyz
Copy link

bdinhxyz commented Feb 2, 2024

Thanks for sharing. I've looked around your git profile to see what default license this is under but could not find anything. Sorry in advance if I just missed it but I am reaching out now to make sure everything is above board before I just use this.

@cmer
Copy link
Author

cmer commented Feb 2, 2024

There you go, I just added a license for you!

@bdinhxyz
Copy link

bdinhxyz commented Feb 3, 2024

Thanks so much!

@kinduff
Copy link

kinduff commented Jul 21, 2024

Thanks for this!

@BasharLulu
Copy link

Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment