Skip to content

Commit 1bf185e

Browse files
committed
feat(react): add scrollbar utility class
1 parent e10d105 commit 1bf185e

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

js/react/lib/styles.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
--color-light: #fafafa;
8585
--color-dark: #2e2e2e;
86-
--color-gray: #D9D9D9;
86+
--color-gray: #d9d9d9;
8787

8888
/* Fonts */
8989
--text-xxs: 10px;
@@ -303,3 +303,30 @@
303303
@apply desktop:text-[40px];
304304
}
305305
}
306+
307+
@layer utilities {
308+
@supports not selector(::-webkit-scrollbar) {
309+
.scrollbar {
310+
scrollbar-color: var(--color-neutral-300) var(--color-neutral-100);
311+
312+
@variant dark {
313+
scrollbar-color: var(--color-neutral-900) var(--color-neutral-600);
314+
}
315+
}
316+
}
317+
318+
.scrollbar::-webkit-scrollbar {
319+
@apply w-4;
320+
}
321+
322+
.scrollbar::-webkit-scrollbar-track {
323+
@apply rounded-full bg-neutral-100 dark:bg-neutral-900;
324+
}
325+
326+
.scrollbar::-webkit-scrollbar-thumb {
327+
@apply rounded-full bg-neutral-300 transition dark:bg-neutral-600;
328+
}
329+
.scrollbar::-webkit-scrollbar-thumb:hover {
330+
@apply opacity-90;
331+
}
332+
}

js/react/showcase/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ export function App() {
258258
},
259259
}}
260260
/>
261+
<ShowComponent title="Scroll bar ">
262+
<div className="scrollbar mx-auto h-48 w-full overflow-auto">
263+
<div className="mx-auto flex h-96 w-20 items-center">Container</div>
264+
</div>
265+
</ShowComponent>
261266
</div>
262267
);
263268
}

0 commit comments

Comments
 (0)