Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbar styling (globally or util class) #122

Open
Tracked by #250
techniq opened this issue Nov 11, 2023 · 1 comment
Open
Tracked by #250

Scrollbar styling (globally or util class) #122

techniq opened this issue Nov 11, 2023 · 1 comment
Milestone

Comments

@techniq
Copy link
Owner

techniq commented Nov 11, 2023

We currently have (.scrollbar-none) to completely hide the scrollbar, but it would be nice to also have some better styling (possibly globally, but at least opt-in).

Styling the scrollbar is setting:

  • ::-webkit-scrollbar
  • ::-webkit-scrollbar-thumb
  • ::-webkit-scrollbar-track

on Chrome/Safari, and

  • scrollbar-color
  • scrollbar-width

on Firefox.

See docs for reference and additional properties

I have an old REPL that can also be used as reference.

.scrollContainer {
	scrollbar-color: var(--scrollcolor) var(--scrollbackground);
}
.scrollContainer::-webkit-scrollbar {
	height: 0.5rem;
	width: 0.5rem;
	border-radius: 1rem;
	background: var(--scrollbackground);
}

.scrollContainer::-webkit-scrollbar-thumb {
	border-radius: 1rem;
	background: var(--scrollcolor);
}

.scrollContainer::-webkit-scrollbar-track {
	border-radius: 1rem;
	background: var(--scrollbackground);
}

See also:

@techniq
Copy link
Owner Author

techniq commented Nov 11, 2023

Appears Skeleton sets this globally with CSS variables (and I've been working on #66 and determining which variables to expose), so this will be helpful for reference.

image

Would like to see if others do this globally (it didn't appear shadcn/ui does, but that's not surprising based on how they implement things).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant