
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@gradin/tailwindcss-scrollbar
Advanced tools
Tailwindcss plugin to customize browser scrollbar.
# Using npm
npm install -D @gradin/tailwindcss-scrollbar
# Using Yarn
yarn add -D @gradin/tailwindcss-scrollbar
Then add the plugin to tailwind.config.js
file.
module.exports = {
theme: {
// ...
},
plugins: [
require('@gradin/tailwindcss-scrollbar'),
],
}
You can customize the size and color of the scrollbar. Also supports any css attributes such as borderRadius
.
⚠️ See release notes if you are upgrading from v1 ⚠️
module.exports = {
theme: {
// ...
},
plugins: [
require('@gradin/tailwindcss-scrollbar')({
size: '5px', // width or height, default '5px'
track: {
background: 'lightgray', // default '#f1f1f1'
// add other css attributes here,
// will be merged to ::-webkit-scrollbar-track
},
thumb: {
background: 'gray', // default '#c1c1c1'
borderRadius: '40px',
// add other css attributes here,
// will be merged to ::-webkit-scrollbar-thumb
},
hover: {
background: 'darkgray', // default '#a8a8a8'
borderRadius: '40px',
// add other css attributes here,
// will be merged to ::-webkit-scrollbar-thumb:hover
},
}),
],
}
To use attributes from your config.theme, you need to override theme.scrollbar.DEFAULT
.
module.exports = {
theme: {
// ...
scrollbar: theme => ({
DEFAULT: {
size: theme('spacing.1'),
track: {
background: theme('colors.gray.300'),
},
thumb: {
background: theme('colors.gray.400'),
},
hover: {
background: theme('colors.gray.500'),
},
},
})
},
plugins: [
require('@gradin/tailwindcss-scrollbar'),
],
}
To set different background color on dark mode, you can use darkBackground
attribute. If unset, they will have the same color as the background
.
track: {
background: theme('colors.gray.300'),
darkBackground: theme('colors.gray.800'),
},
thumb: {
background: theme('colors.gray.400'),
darkBackground: theme('colors.gray.600'),
},
hover: {
background: theme('colors.gray.500'),
darkBackground: theme('colors.gray.500'),
},
To hide the scrollbar but still make it scrollable, use scrollbar-none
class
on the element with overflow: auto | scroll
.
<div class="overflow-auto scrollbar-none">
<!-- Very long content here -->
</div>
This is done by using scrollbar-width: none
on Firefox and ::-webkit-scrollbar{display:none}
on Chrome.
This plugin uses ::-webkit-scrollbar
to modify scrollbar style.
Not supported in all versions of Firefox and Edge version 78 or older.
.scrollbar-none
is supported on Firefox version 64 or newer.
FAQs
Tailwindcss plugin to customize scrollbar.
The npm package @gradin/tailwindcss-scrollbar receives a total of 2,172 weekly downloads. As such, @gradin/tailwindcss-scrollbar popularity was classified as popular.
We found that @gradin/tailwindcss-scrollbar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.