UNPKG

vue-chips-generator

Version:

A Vue 3 component for creating and managing keyword chips. This component allows users to input keywords, automatically handles uniqueness, and provides customizable styles.

132 lines (119 loc) 2.24 kB
.container { display: flex; flex-direction: column; align-items: flex-start; } .textfield-container { position: relative; display: inline-block; width: 240px; } input { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 16px; background-color: white; } label { position: absolute; top: 12px; left: 12px; font-size: 16px; color: #aaa; pointer-events: none; transition: all 0.2s ease; background-color: white; padding: 0 4px; } input:focus + label, label.active { top: -10px; left: 10px; font-size: 12px; color: #007bff; } input[type="date"] { padding-right: 0; /* Adjust padding if needed */ } input:focus { border-color: #007bff; outline: none; } span { color: red; font-size: 12px; margin-top: 4px; display: block; } .chips-container { margin-top: 10px; max-height: 60px; overflow-y: auto; display: flex; flex-wrap: wrap; width: 100%; } .chip { position: relative; margin: 5px; padding: 5px 10px; border-radius: 15px; color: white; font-weight: bold; display: flex; align-items: center; } .tooltip { position: absolute; bottom: 100%; left: 0; margin-bottom: 5px; padding: 5px 10px; background-color: #ff6b6b; color: white; border-radius: 3px; font-size: 0.8em; white-space: nowrap; z-index: 1; transform: translateY(0); opacity: 1; transition: opacity 0.2s, transform 0.2s; } .tooltip::after { content: ""; position: absolute; top: 100%; left: 10px; border-width: 5px; border-style: solid; border-color: #ff6b6b transparent transparent transparent; } .cancel-icon { position: absolute; top: -10px; right: -5px; cursor: pointer; background-color: #e3dede; border-radius: 50%; padding: 2px 6px; font-weight: bold; color: black; line-height: 1; } .chips-container::-webkit-scrollbar { width: 10px; } .chips-container::-webkit-scrollbar-track { background-color: #f0f0f0; border-radius: 10px; } .chips-container::-webkit-scrollbar-thumb { background-color: black; border-radius: 10px; transition: background-color 0.3s; } .chips-container::-webkit-scrollbar-thumb:hover { background-color: black; }