geeks-ui-framework
Version:
A modern, lightweight CSS framework with 15+ components for developers. Build beautiful interfaces with minimal effort.
202 lines (172 loc) • 4.17 kB
CSS
/* Dropdown Component */
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-toggle {
background: var(--primary-color, #667eea);
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 0.5rem;
}
.dropdown-toggle:hover {
background: var(--primary-dark, #5a6fd8);
transform: translateY(-1px);
}
.dropdown-toggle::after {
content: '▼';
font-size: 0.75rem;
transition: transform 0.3s ease;
}
.dropdown-toggle[aria-expanded="true"]::after {
transform: rotate(180deg);
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
min-width: 10rem;
padding: 0.5rem 0;
margin: 0.125rem 0 0;
background: white;
border: 1px solid var(--border-color, #dee2e6);
border-radius: 0.375rem;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
animation: dropdownSlide 0.3s ease;
}
.dropdown-menu.show {
display: block;
}
@keyframes dropdownSlide {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.dropdown-item {
display: block;
width: 100%;
padding: 0.5rem 1rem;
clear: both;
font-weight: 400;
color: var(--dark-color, #212529);
text-align: inherit;
text-decoration: none;
white-space: nowrap;
background: transparent;
border: none;
cursor: pointer;
transition: all 0.2s ease;
}
.dropdown-item:hover,
.dropdown-item:focus {
background: var(--light-color, #f8f9fa);
color: var(--primary-color, #667eea);
}
.dropdown-item.active {
background: var(--primary-color, #667eea);
color: white;
}
.dropdown-item:disabled,
.dropdown-item.disabled {
color: var(--muted-color, #6c757d);
pointer-events: none;
background: transparent;
cursor: not-allowed;
}
.dropdown-divider {
height: 0;
margin: 0.5rem 0;
overflow: hidden;
border-top: 1px solid var(--border-color, #dee2e6);
}
.dropdown-header {
display: block;
padding: 0.5rem 1rem;
margin-bottom: 0;
font-size: 0.875rem;
color: var(--muted-color, #6c757d);
white-space: nowrap;
font-weight: 600;
}
/* Dropdown Directions */
.dropup .dropdown-menu {
top: auto;
bottom: 100%;
margin-top: 0;
margin-bottom: 0.125rem;
}
.dropend .dropdown-menu {
top: 0;
right: auto;
left: 100%;
margin-top: 0;
margin-left: 0.125rem;
}
.dropstart .dropdown-menu {
top: 0;
right: 100%;
left: auto;
margin-top: 0;
margin-right: 0.125rem;
}
/* Dropdown Variants */
.dropdown-toggle-secondary {
background: var(--secondary-color, #6c757d);
}
.dropdown-toggle-success {
background: var(--success-color, #28a745);
}
.dropdown-toggle-warning {
background: var(--warning-color, #ffc107);
color: var(--dark-color, #212529);
}
.dropdown-toggle-danger {
background: var(--danger-color, #dc3545);
}
.dropdown-toggle-outline {
background: transparent;
color: var(--primary-color, #667eea);
border: 1px solid var(--primary-color, #667eea);
}
.dropdown-toggle-outline:hover {
background: var(--primary-color, #667eea);
color: white;
}
/* Dropdown Sizes */
.dropdown-toggle-sm {
padding: 0.25rem 0.75rem;
font-size: 0.875rem;
}
.dropdown-toggle-lg {
padding: 0.75rem 1.5rem;
font-size: 1.25rem;
}
/* Dark Dropdown */
.dropdown-menu-dark {
background: var(--dark-color, #343a40);
border-color: var(--dark-border, #495057);
}
.dropdown-menu-dark .dropdown-item {
color: var(--light-color, #f8f9fa);
}
.dropdown-menu-dark .dropdown-item:hover {
background: var(--secondary-color, #495057);
color: white;
}
.dropdown-menu-dark .dropdown-divider {
border-top-color: var(--dark-border, #495057);
}