Skip to content

Commit c472bc8

Browse files
committed
feature: SelectBox has custom scrollbar
1 parent fb66637 commit c472bc8

File tree

3 files changed

+107
-3
lines changed

3 files changed

+107
-3
lines changed

packages/design-system/src/css/style.css

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@
99

1010
@config '../../tailwind.config.ts';
1111

12+
:root {
13+
--fg-color: #000;
14+
--bg-color: #fff;
15+
--comfy-menu-bg: #353535;
16+
--comfy-menu-secondary-bg: #292929;
17+
--comfy-topbar-height: 2.5rem;
18+
--comfy-input-bg: #222;
19+
--input-text: #ddd;
20+
--descrip-text: #999;
21+
--drag-text: #ccc;
22+
--error-text: #ff4444;
23+
--border-color: #4e4e4e;
24+
--tr-even-bg-color: #222;
25+
--tr-odd-bg-color: #353535;
26+
--primary-bg: #236692;
27+
--primary-fg: #ffffff;
28+
--primary-hover-bg: #3485bb;
29+
--primary-hover-fg: #ffffff;
30+
--content-bg: #e0e0e0;
31+
--content-fg: #000;
32+
--content-hover-bg: #adadad;
33+
--content-hover-fg: #000;
34+
35+
/* Code styling colors for help menu*/
36+
--code-text-color: rgba(0, 122, 255, 1);
37+
--code-bg-color: rgba(96, 165, 250, 0.2);
38+
--code-block-bg-color: rgba(60, 60, 60, 0.12);
39+
40+
/* Scrollbar tokens (colors reuse existing palette) */
41+
--scrollbar-size: 10px; /* width/height for webkit scrollbars */
42+
--scrollbar-track: var(--color-white);
43+
--scrollbar-thumb: var(--color-gray-400);
44+
--scrollbar-thumb-hover: var(--color-gray-400);
45+
}
46+
1247
@media (prefers-color-scheme: dark) {
1348
:root {
1449
--fg-color: #fff;
@@ -17,9 +52,27 @@
1752
--content-fg: #fff;
1853
--content-hover-bg: #222;
1954
--content-hover-fg: #fff;
55+
--scrollbar-track: var(--color-charcoal-600);
56+
/* Dark overrides for scrollbar */
57+
--scrollbar-thumb: var(--color-charcoal-100);
58+
--scrollbar-thumb-hover: var(--color-gray-800);
2059
}
2160
}
2261

62+
/* Dark theme variable overrides for class-based theming */
63+
.dark-theme {
64+
/* ensure tokens match dark scheme even without prefers-color-scheme */
65+
--scrollbar-track: var(--color-charcoal-600);
66+
--scrollbar-thumb: var(--color-charcoal-100);
67+
--scrollbar-thumb-hover: var(--color-gray-800);
68+
/* let UA widgets (including scrollbars) render in dark mode where supported */
69+
color-scheme: dark;
70+
}
71+
/* Ensure scrollable containers participate in dark color-scheme */
72+
.dark-theme .custom-scrollbar {
73+
color-scheme: dark;
74+
}
75+
2376
@theme {
2477
--text-xxs: 0.625rem;
2578
--text-xxs--line-height: calc(1 / 0.625);
@@ -324,7 +377,58 @@
324377
}
325378
}
326379

327-
/* Everything below here to be cleaned up over time. */
380+
381+
/* ===================== Custom Scrollbar (cross-browser) =====================
382+
Usage: Add `custom-scrollbar` class to any scrollable container.
383+
Notes:
384+
- Firefox uses `scrollbar-width` and `scrollbar-color`.
385+
- WebKit/Blink (Chrome/Edge/Safari) use `::-webkit-scrollbar` pseudo elements.
386+
- macOS/iOS show overlay scrollbars; thick tracks may appear slimmer there.
387+
- Uses existing CSS variables (tokens) for colors and size.
388+
============================================================================ */
389+
@layer components {
390+
/* Base (light) theme */
391+
.custom-scrollbar {
392+
/* Firefox */
393+
scrollbar-width: thin; /* auto | thin | none */
394+
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); /* thumb track */
395+
/* Layout stability where supported */
396+
scrollbar-gutter: stable both-edges; /* ignored if unsupported */
397+
}
398+
.custom-scrollbar::-webkit-scrollbar {
399+
width: var(--scrollbar-size);
400+
height: var(--scrollbar-size);
401+
}
402+
.custom-scrollbar::-webkit-scrollbar-track {
403+
background: var(--scrollbar-track);
404+
}
405+
.custom-scrollbar::-webkit-scrollbar-thumb {
406+
background: var(--scrollbar-thumb);
407+
border-radius: 999px;
408+
border: 2px solid var(--scrollbar-track); /* visual separation from track */
409+
}
410+
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
411+
background: var(--scrollbar-thumb-hover); /* hover color */
412+
}
413+
414+
/* Dark theme overrides (scoped to your `.dark-theme` root) */
415+
.dark-theme .custom-scrollbar {
416+
scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); /* thumb track */
417+
}
418+
.dark-theme .custom-scrollbar::-webkit-scrollbar-track {
419+
background: var(--scrollbar-track);
420+
}
421+
.dark-theme .custom-scrollbar::-webkit-scrollbar-thumb {
422+
background: var(--scrollbar-thumb);
423+
border: 2px solid var(--scrollbar-track);
424+
}
425+
.dark-theme .custom-scrollbar::-webkit-scrollbar-thumb:hover {
426+
background: var(--scrollbar-thumb-hover); /* hover color */
427+
}
428+
}
429+
/* =================== End Custom Scrollbar (cross-browser) =================== */
430+
431+
/* Everthing below here to be cleaned up over time. */
328432

329433
body {
330434
width: 100vw;

src/components/input/MultiSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ const pt = computed(() => ({
243243
},
244244
listContainer: () => ({
245245
style: { maxHeight: listMaxHeight },
246-
class: 'overflow-y-auto scrollbar-hide'
246+
class: 'overflow-y-auto custom-scrollbar'
247247
}),
248248
list: {
249249
class: 'flex flex-col gap-0 p-0 m-0 list-none border-none text-sm'

src/components/input/SingleSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const pt = computed(() => ({
159159
},
160160
listContainer: () => ({
161161
style: `max-height: ${listMaxHeight}`,
162-
class: 'overflow-y-auto scrollbar-hide'
162+
class: 'overflow-y-auto custom-scrollbar'
163163
}),
164164
list: {
165165
class:

0 commit comments

Comments
 (0)