@codinglane/dropdown
Version:
An easy-to-use react dropdown
137 lines (117 loc) • 2.8 kB
CSS
.dropdown {
position: relative;
display: flex;
height: 21px;
}
.dropdown-option-container,
.dropdown-option,
.dropdown-searchinput,
.dropdown-searchtext,
.dropdown-text.dropdown-readonly,
.dropdown-searchicon {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.dropdown-placeholder {
opacity: 0.4;
font-style: italic;
}
.dropdown-content {
display: none;
position: fixed;
background-color: var(--dropdownBackgroundColor);
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
padding: 4px 0px;
color: var(--dropdownPrimaryColor);
z-index: 1;
max-height: 150px;
overflow: auto;
border-radius: 4px;
border: 1px solid var(--dropdownPrimaryColor);
}
.dropdown-content.dropdown-grouped {
padding: 0px;
}
.dropdown-grouping {
padding: 0px 0px 4px 0px;
}
.dropdown-option-container {
padding: 0.5em;
display: flex;
flex-direction: row;
justify-content: left;
align-items: center;
cursor: pointer;
}
.dropdown-option {
white-space: nowrap;
margin-block-start: 0em;
margin-block-end: 0em;
font-size: var(--dropdownFontSize);
font-family: var(--dropdownFontFamily);
height: 100%;
}
.dropdown-option.group-option {
padding: 0.5em 0.2em;
}
.dropdown-search {
position: relative;
}
.dropdown-searchtext {
position: absolute;
padding: 1px 2px;
}
.dropdown-searchinput,
.dropdown-searchtext {
color: inherit;
background: none;
border: none;
border-bottom: none ;
width: min-content;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dropdown-text {
cursor: text;
}
.dropdown-group-label {
position: -webkit-sticky;
position: sticky;
top: 0;
padding: 0.5em 2px;
font-weight: bold;
font-size: var(--dropdownFontSize);
font-family: var(--dropdownFontFamily);
background-color: var(--dropdownBackgroundColor);
border-bottom: 1px solid var(--dropdownPrimaryColor);
box-shadow: 0px 8px 8px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-text.dropdown-readonly {
cursor: pointer;
}
.dropdown-searchicon {
position: absolute;
right: 0px;
top: 2.5px;
stroke-width: 3;
cursor: pointer;
}
.dropdown-option-favorite {
margin-right: 10px;
}
.selected-dropdown {
font-weight: bold;
}
.dropdown-option-container:hover {
color: var(--dropdownBackgroundColor);
background-color: var(--dropdownPrimaryColor);
}
.dropdown.active .dropdown-content {
display: block;
}