tailwind-scrollbar-styles 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -0
- package/package.json +47 -0
- package/src/styles.css +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 reslear
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# tailwind-scrollbar-styles
|
|
2
|
+
|
|
3
|
+
Tailwind plugin for scrollbars styles, although the element can still be scrolled if the element's content overflows.
|
|
4
|
+
|
|
5
|
+
<img src="https://user-images.githubusercontent.com/12596485/142972957-272010d3-29f6-4be7-99e1-dd03e7a8b92b.gif" alt="tailwind-scrollbar-styles animation demo" width="400" />
|
|
6
|
+
|
|
7
|
+
[🕹 Live Playground](https://github.com/reslear1100/tailwind-scrollbar-styles/)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
🎨 Tailwind v4.x, v3.x, v2.x.
|
|
12
|
+
|
|
13
|
+
📦 Zero dependencies
|
|
14
|
+
|
|
15
|
+
🛠️ Port for [unocss-preset-scrollbar-styles](https://github.com/reslear1100/tailwind-scrollbar-styles)
|
|
16
|
+
|
|
17
|
+
🎯 Pure CSS implementation for v4.x
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install the plugin from npm:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
# Using npm
|
|
25
|
+
npm install tailwind-scrollbar-styles
|
|
26
|
+
|
|
27
|
+
# Using pnpm
|
|
28
|
+
pnpm add tailwind-scrollbar-styles
|
|
29
|
+
|
|
30
|
+
# Using Yarn
|
|
31
|
+
yarn add tailwind-scrollbar-styles
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Tailwind v4 support
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
For Tailwind v4, you can use the following approach in your CSS configuration file:
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
/* index.css */
|
|
43
|
+
@import 'tailwindcss';
|
|
44
|
+
@import 'tailwind-scrollbar-styles/v4';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This will automatically import and configure the plugin for Tailwind v4.
|
|
48
|
+
|
|
49
|
+
> Note: Internet Explorer functionality has been dropped in Tailwind v4
|
|
50
|
+
|
|
51
|
+
### Tailwind v2.x, v3.x support
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
For Tailwind v2.x and v3.x, add the plugin to your config file:
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
// tailwind.config.js
|
|
60
|
+
module.exports = {
|
|
61
|
+
theme: {
|
|
62
|
+
// ...
|
|
63
|
+
},
|
|
64
|
+
plugins: [
|
|
65
|
+
require('tailwind-scrollbar-styles')
|
|
66
|
+
// ...
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
or [using TypeScript](https://tailwindcss.com/docs/configuration#using-esm-or-type-script):
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
// tailwind.config.ts
|
|
75
|
+
import type { Config } from 'tailwindcss'
|
|
76
|
+
import scrollbarStyles from 'tailwind-scrollbar-styles'
|
|
77
|
+
|
|
78
|
+
export default {
|
|
79
|
+
theme: {
|
|
80
|
+
// ...
|
|
81
|
+
},
|
|
82
|
+
plugins: [scrollbarStyles]
|
|
83
|
+
} satisfies Config
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
Use in you template `scrollbar-default` for visual default scrollbar
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<div class="w-4 scrollbar-default">...</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
or restore default value use `scrollbar-default`
|
|
95
|
+
|
|
96
|
+
> ⚠️ webkit overriding not working https://github.com/reslear1100/tailwind-scrollbar-styles/issues/19#issuecomment-1086949110 need switch breakpoint system
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<div class="w-4 scrollbar-default md:scrollbar-default">...</div>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Plugin Inspiration
|
|
103
|
+
|
|
104
|
+
- https://github.com/tailwindlabs/tailwindcss-forms/tree/main
|
|
105
|
+
- https://github.com/tailwindlabs/tailwindcss/discussions/2310#discussioncomment-8592440
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
[MIT](./LICENSE)
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind plugin for hide scrollbars, although the element can still be scrolled if the element's content overflows.
|
|
3
|
+
*/
|
|
4
|
+
const scrollbarHide = ({ addUtilities }) => addUtilities({
|
|
5
|
+
'.scrollbar-hide': {
|
|
6
|
+
// TODO: remove IE and Edge support
|
|
7
|
+
/* IE and Edge */
|
|
8
|
+
'-ms-overflow-style': 'none',
|
|
9
|
+
/* Firefox */
|
|
10
|
+
'scrollbar-width': 'none',
|
|
11
|
+
/* Safari and Chrome */
|
|
12
|
+
'&::-webkit-scrollbar': {
|
|
13
|
+
display: 'none'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
'.scrollbar-default': {
|
|
17
|
+
// TODO: remove IE and Edge support
|
|
18
|
+
/* IE and Edge */
|
|
19
|
+
'-ms-overflow-style': 'auto',
|
|
20
|
+
/* Firefox */
|
|
21
|
+
'scrollbar-width': 'auto',
|
|
22
|
+
/* Safari and Chrome */
|
|
23
|
+
'&::-webkit-scrollbar': {
|
|
24
|
+
display: 'block'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
// override type for v3/4 compatibility
|
|
29
|
+
export default scrollbarHide;
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tailwind-scrollbar-styles",
|
|
3
|
+
"version": "4.0.1",
|
|
4
|
+
"description": "tailwindcss plugin for scrollbar styles",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"tailwindcss",
|
|
7
|
+
"scrollbar",
|
|
8
|
+
"scrollbar-styles"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/reslear1100/tailwind-scrollbar-styles#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/reslear1100/tailwind-scrollbar-styles/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/reslear1100/tailwind-scrollbar-styles.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "reslear",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./v4": "./src/styles.css"
|
|
28
|
+
},
|
|
29
|
+
"main": "dist/index.js",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src/styles.css"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.15.28",
|
|
38
|
+
"tailwindcss": "4.1.8",
|
|
39
|
+
"typescript": "5.8.3"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"tailwindcss": ">=3.0.0 || >= 4.0.0 || >= 4.0.0-beta.8 || >= 4.0.0-alpha.20"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@utility scrollbar-hide {
|
|
2
|
+
/* Firefox */
|
|
3
|
+
scrollbar-width: none;
|
|
4
|
+
|
|
5
|
+
/* Safari and Chrome */
|
|
6
|
+
&::-webkit-scrollbar {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@utility scrollbar-default {
|
|
12
|
+
/* Firefox */
|
|
13
|
+
scrollbar-width: auto;
|
|
14
|
+
|
|
15
|
+
/* Safari and Chrome */
|
|
16
|
+
&::-webkit-scrollbar {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
}
|