react-multi-select-tabs
Version:
A modern, accessible multi-select component with search functionality and visible selected tabs
1 lines • 5.08 kB
CSS
.rms-container{@apply relative w-full;position:relative;width:100%}.rms-container.rms-disabled{@apply opacity-50 cursor-not-allowed;cursor:not-allowed;opacity:.5}.rms-input-area{@apply flex items-center justify-between p-2 border border-gray-300 rounded-lg bg-white cursor-pointer min-h-[42px] focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500;align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:.5rem;cursor:pointer;display:flex;justify-content:space-between;min-height:42px;padding:.5rem;transition:border-color .2s,box-shadow .2s}.rms-input-area:focus-within{border-color:#3b82f6;box-shadow:0 0 0 2px rgba(59,130,246,.5);outline:none}.rms-disabled .rms-input-area{@apply cursor-not-allowed bg-gray-50;background-color:#f9fafb;cursor:not-allowed}.rms-tags-container{@apply flex flex-wrap items-center gap-1 flex-1 min-w-0;align-items:center;display:flex;flex:1;flex-wrap:wrap;gap:.25rem;min-width:0}.rms-tag{@apply inline-flex items-center px-2 py-1 bg-blue-100 text-blue-800 rounded-md text-sm font-medium;align-items:center;background-color:#dbeafe;border-radius:.375rem;color:#1e40af;display:inline-flex;font-size:.875rem;font-weight:500;line-height:1.25rem;padding:.25rem .5rem}.rms-tag-remove{@apply ml-1 text-blue-600 hover:text-blue-800 focus:outline-none focus:ring-1 focus:ring-blue-500 rounded;background:none;border:none;border-radius:.25rem;color:#2563eb;cursor:pointer;font-size:1.125rem;line-height:1;margin-left:.25rem;padding:0}.rms-tag-remove:hover{color:#1e40af}.rms-tag-remove:focus{box-shadow:0 0 0 1px #3b82f6;outline:none}.rms-search-input{@apply flex-1 min-w-0 border-none outline-none bg-transparent text-gray-900 placeholder-gray-500 text-sm;background:transparent;border:none;color:#111827;flex:1;font-size:.875rem;line-height:1.25rem;min-width:0;outline:none}.rms-search-input::placeholder{color:#6b7280}.rms-controls{@apply flex items-center gap-2 ml-2;align-items:center;display:flex;gap:.5rem;margin-left:.5rem}.rms-clear-button{@apply text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-1 focus:ring-blue-500 rounded w-4 h-4 flex items-center justify-center;align-items:center;background:none;border:none;border-radius:.25rem;color:#9ca3af;cursor:pointer;display:flex;font-size:1.125rem;height:1rem;justify-content:center;line-height:1;width:1rem}.rms-clear-button:hover{color:#4b5563}.rms-clear-button:focus{box-shadow:0 0 0 1px #3b82f6;outline:none}.rms-chevron{@apply text-gray-400 transition-transform duration-200 w-4 h-4 flex items-center justify-center;align-items:center;color:#9ca3af;display:flex;height:1rem;justify-content:center;transition:transform .2s;width:1rem}.rms-chevron-up{transform:rotate(180deg)}.rms-chevron-down{transform:rotate(0deg)}.rms-dropdown{@apply absolute top-full left-0 right-0 mt-1 bg-white border border-gray-300 rounded-lg shadow-lg z-50 max-h-60 overflow-hidden;background-color:#fff;border:1px solid #d1d5db;border-radius:.5rem;box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05);left:0;margin-top:.25rem;max-height:15rem;overflow:hidden;position:absolute;right:0;top:100%;z-index:50}.rms-dropdown-open{@apply block;display:block}.rms-loading{@apply flex items-center justify-center p-4 text-gray-500;align-items:center;color:#6b7280;display:flex;gap:.5rem;justify-content:center;padding:1rem}.rms-loading-spinner{@apply w-4 h-4 border-2 border-gray-300 border-t-blue-600 rounded-full animate-spin;animation:spin 1s linear infinite;border:2px solid #d1d5db;border-radius:50%;border-top-color:#2563eb;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(1turn)}}.rms-no-options{@apply p-4 text-gray-500 text-center text-sm;color:#6b7280;font-size:.875rem;padding:1rem;text-align:center}.rms-options-container{@apply max-h-48 overflow-y-auto;max-height:12rem;overflow-y:auto}.rms-option{@apply w-full text-left px-3 py-2 text-sm text-gray-900 hover:bg-gray-50 focus:bg-gray-50 focus:outline-none border-none cursor-pointer;background:none;border:none;color:#111827;cursor:pointer;font-size:.875rem;padding:.5rem .75rem;text-align:left;transition:background-color .2s;width:100%}.rms-option:focus,.rms-option:hover{background-color:#f9fafb}.rms-option:focus{outline:none}.rms-option-highlighted{@apply bg-blue-50 text-blue-900;background-color:#eff6ff;color:#1e3a8a}.rms-option-disabled{@apply opacity-50 cursor-not-allowed;cursor:not-allowed;opacity:.5}.rms-selection-info{@apply px-3 py-2 text-xs text-gray-500 bg-gray-50 border-t border-gray-200;background-color:#f9fafb;border-top:1px solid #e5e7eb;color:#6b7280;font-size:.75rem;padding:.5rem .75rem}@media (max-width:640px){.rms-dropdown{max-height:12rem}.rms-options-container{max-height:10rem}}.rms-container:focus-within .rms-input-area{border-color:#3b82f6;box-shadow:0 0 0 2px rgba(59,130,246,.5)}@media (prefers-contrast:high){.rms-input-area{border-width:2px}.rms-tag{border:1px solid}.rms-option-highlighted{background-color:#000;color:#fff}}@media (prefers-reduced-motion:reduce){.rms-chevron{transition:none}.rms-loading-spinner{animation:none}}