An open API service indexing awesome lists of open source software.

https://github.com/siibragimov/vue-smooth-scrollbar-ts

Vue 3 and Nuxt 3 compatible smooth-scrollbar component
https://github.com/siibragimov/vue-smooth-scrollbar-ts

custom-scrollbar mac macos nuxt3 scroll scroll-style scrollbar scrollbar-style smooth-scrolling typescript vue3

Last synced: 5 months ago
JSON representation

Vue 3 and Nuxt 3 compatible smooth-scrollbar component

Awesome Lists containing this project

README

          

# Vue 3 and Nuxt 3 smooth scrollbar component

Add your styled scrollbar to any block, which will look consistent across all platforms. To see how it works, please, see the demo.

[![npm version](https://badge.fury.io/js/vue-smooth-scrollbar-ts.svg)](https://badge.fury.io/js/vue-smooth-scrollbar-ts)
[![Github Package](https://github.com/siibragimov/vue-smooth-scrollbar-ts/actions/workflows/npm-publish-github-packages.yml/badge.svg)](https://github.com/siibragimov/vue-smooth-scrollbar-ts/actions/workflows/npm-publish-github-packages.yml)
[![Node.js Package](https://github.com/siibragimov/vue-smooth-scrollbar-ts/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/siibragimov/vue-smooth-scrollbar-ts/actions/workflows/npm-publish.yml)
[![Bundle size](https://badgen.net/bundlephobia/minzip/vue-smooth-scrollbar-ts)](https://bundlephobia.com/package/vue-smooth-scrollbar-ts)

Based on [https://idiotwu.github.io/smooth-scrollbar/](https://idiotwu.github.io/smooth-scrollbar/).

## Demo
There are two examples in the demo. One of them with custom styles.
![Demo](https://raw.github.com/siibragimov/vue-smooth-scrollbar-ts/main/public/demo.webp)

## Installation and setup

### 1. Install component:
If you want to install package from __npmjs registry__(recommended) use:
```shell
npm i vue-smooth-scrollbar-ts
```

```shell
yarn add vue-smooth-scrollbar-ts
```

```shell
pnpm add vue-smooth-scrollbar-ts
```

If you want to install package from __GitHub packages__ use:

```shell
npm install @siibragimov/vue-smooth-scrollbar-ts
```
**Note**: Don't forget to configure registry for installing packages from GitHub. Use __.npmrc__ file or use command:
```shell
npm config set registry https://npm.pkg.github.com/
```

### 2. Import CSS.
For Vue 3:
```javascript
// in entry point (main.js)
import '../node_modules/vue-smooth-scrollbar-ts/dist/style.css';
```
For Nuxt 3:
```javascript
// nuxt.config.ts
export default defineNuxtConfig({
css: ['~/node_modules/vue-smooth-scrollbar-ts/dist/style.css'],
});
```
**Note**: If you have problems with import, check the file path and especially the prefix.

### 3. Define overriding styles for scrollbars if needed. See the [`App.vue`](/src/App.vue).

**Note**: to make component work properly add height or width styling properties explicitly for the parent block of component. It behaviour is very close to the scroll when you use `overflow: scroll`. For more info checkout [this page](https://github.com/idiotWu/smooth-scrollbar/tree/develop/docs#common-mistakes).

### 4. Import component in your code:
```javascript
import { VueSmoothScrollbarTs } from 'vue-smooth-scrollbar-ts'
```

### 5. Wrap content you want to be scrolled.

Example:
```javascript



```
## Properties

| Name | Type | Default | Description |
| ------------- | ------------- | ------------- | ------------- |
| __options__ | `ScrollbarOptions` | `{}` | check the list [here](https://github.com/idiotWu/smooth-scrollbar/tree/develop/docs#available-options-for-scrollbar) |
| __plugins__ | `Array` | `[]` | check the list [here](https://github.com/idiotWu/smooth-scrollbar/tree/develop/docs) |
| __scrollIntoView__ | `boolean` | `false` | Scrolls the block into viewport when the user points cursor over it |

## Contributing

To run in development mode
```shell
npm run dev
```

Use for build component
```shell
npm run build
```
and follow the instruction in console to open the test page.

To generate types you can use:
```shell
npm run types
```