tailwind-modern-scroll
v0.0.9
Published
It's a customizable scroll bar plugin for the tailwind css framework.
Downloads
20
Readme
Tailwind Modern Scrollbars
This plugin provides dynamic directives that allow you to format scrollbars and scroll thumbs in your projects that use the tailwind framework.
Installation
First, you have to download the plugin to your project.
npm i tailwind-modern-scroll -D
Configuration
You need to add the plugin to the main tailwind configuration file.
your-project/tailwind.config.js
const modernScroll = require( "tailwind-modern-scroll" );
module.exports =
{
// other configs...
plugins:
[
modernScroll,
// ...other plugins
],
// ...other configs
}
Usage
If you prefer to use VS Code and installed tailwind intellisense extension our directives will suggest to you in it.
base class
First of all you have to add modern-scroll
base class to your items that have scroll bars. This provides the basic features that meet the minimum requirements for the scrollbar to look modern.
<div class="h-96 w-full overflow-auto modern-scroll"></div>
coloring
You can change both the scroll bar background and the scroll thumb background colors with theme colors or direct colors.
<div class="... modern-scroll scroll-sky-100 thumb-[#fc0]"></div>
You can even use opacity modifiers too.
<div class="... scroll-[#000]/20 thumb-[#000]/20"></div>
width
You can only change scroll wrapper width and not thumb's.
<div class="... scroll-w-10"></div>
height
We can also change the height of the scroll wrapper.
<div class="... scroll-h-10"></div>
thumb height limiting
You can specify the minimum and maximum height of the slider.
<div class="... thumb-min-h-10 thumb-max-h-20"></div>
rounding
You can round the edges both of the scroll wrapper and the thumb.
<div class="... scroll-round-full thumb-round-full"></div>