|
1 | | -# vue3-marquee |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -This template should help get you started developing with Vue 3 in Vite. |
| 3 | +# Marquee <br> 🌬️ |
4 | 4 |
|
5 | | -## Recommended IDE Setup |
| 5 | +> A beautiful marquee component for Vue. |
6 | 6 |
|
7 | | -[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). |
| 7 | +</div> |
8 | 8 |
|
9 | | -## Type Support for `.vue` Imports in TS |
| 9 | +## Installation |
10 | 10 |
|
11 | | -TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. |
| 11 | +```bash |
| 12 | +npm install @selemondev/vue3-marquee |
| 13 | +``` |
| 14 | +or you can skip npm install, and just copy and paste the source code into your component like Shadcn Vue (don't forget to also copy the tailwind config if you do this). |
12 | 15 |
|
13 | | -If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: |
| 16 | +## Register it as a global component |
14 | 17 |
|
15 | | -1. Disable the built-in TypeScript Extension |
16 | | - 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette |
17 | | - 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` |
18 | | -2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. |
| 18 | +```js |
| 19 | +import { Marquee } from "@selemondev/vue3-marquee"; |
| 20 | +import "@selemondev/vue3-marquee/dist/style.css" |
| 21 | +import { createApp } from 'vue' |
| 22 | +import App from './App.vue' |
19 | 23 |
|
20 | | -## Customize configuration |
| 24 | +const app = createApp(App); |
| 25 | +app.component('Marquee', Marquee) |
| 26 | +app.mount('#app') |
| 27 | +``` |
21 | 28 |
|
22 | | -See [Vite Configuration Reference](https://vitejs.dev/config/). |
| 29 | +or |
23 | 30 |
|
24 | | -## Project Setup |
| 31 | +## Register it as a local component |
25 | 32 |
|
26 | | -```sh |
27 | | -npm install |
| 33 | +```js |
| 34 | +import { Marquee } from "@selemondev/vue3-marquee"; |
| 35 | +import "@selemondev/vue3-marquee/dist/style.css" |
28 | 36 | ``` |
29 | 37 |
|
30 | | -### Compile and Hot-Reload for Development |
| 38 | +## Nuxt |
| 39 | + |
| 40 | +If you are using Nuxt 3, you can simply register it as a Nuxt plugin as shown below: |
31 | 41 |
|
32 | | -```sh |
33 | | -npm run dev |
| 42 | +```ts |
| 43 | +// plugins/marquee.ts |
| 44 | + |
| 45 | +import { Marquee } from "@selemondev/vue3-marquee"; |
| 46 | +import "@selemondev/vue3-marquee/dist/style.css" |
| 47 | +export default defineNuxtPlugin((nuxtApp) => { |
| 48 | + nuxtApp.vueApp.component('Marquee', Marquee) |
| 49 | +}) |
34 | 50 | ``` |
35 | 51 |
|
36 | | -### Type-Check, Compile and Minify for Production |
| 52 | +## Usage |
| 53 | + |
| 54 | +The library has a few props that are self-explanatory; you can get it running in no time. See the web examples for more details. |
37 | 55 |
|
38 | | -```sh |
39 | | -npm run build |
| 56 | +```js |
| 57 | +<Marquee |
| 58 | + :fade="true" |
| 59 | + direction="left" |
| 60 | + :reverse="false" |
| 61 | + :pauseOnHover="false" |
| 62 | + className="" // pass class to change gap or speed |
| 63 | + innerClassName="" // pass class to change gap or speed |
| 64 | +> |
| 65 | + <div>Content 1</div> |
| 66 | + <div>Content 2</div> |
| 67 | + <div>Content 3</div> |
| 68 | + <div>Content 4</div> |
| 69 | +</Marquee> |
40 | 70 | ``` |
| 71 | + |
| 72 | +This library is made specifically for Tailwind users, however you can also use vanilla CSS classes to override the gap. |
| 73 | + |
| 74 | +## Credits |
| 75 | + |
| 76 | +- Inspired by [@devnomic's](https://github.com/devnomic) React Marquee component. |
| 77 | + |
| 78 | +## License |
| 79 | + |
| 80 | +Released under [MIT](/LICENSE) by [@selemondev](https://github.com/selemondev). |
| 81 | + |
0 commit comments