# Wheel Spinner Component A customizable wheel spinner component built with Vue.js. ![image](https://github.com/ilyasozkurt/vue-wheel-spinner/assets/4955440/08cb6195-60eb-4ac4-82cb-2a4b5296dc5e) ## Table of Contents - [Installation](#installation) - [Usage](#usage) - [Props](#props) - [Slots](#slots) - [Events](#events) - [License](#license) - [Demo](https://vue-wheel-spinner-demo.vercel.app/) - [Demo Project Source](https://stackblitz.com/~/github.com/ilyasozkurt/vue-wheel-spinner) ## Installation To use this component, you need to have a Vue.js project set up. If you don't have one, you can create a new Vue.js project using Vue CLI: ```sh npm install -g @vue/cli vue create my-project cd my-project ``` Install the component ```sh npm install vue-wheel-spinner ``` ## Usage Import and register the component in your Vue component: ```vue ``` ## Props | Prop | Type | Default | Description | |-----------------------------|--------|------------|--------------------------------------------------------------------------------------| | `slices` | Array | required | Array of slice objects. Each slice object should have `color` and `text` properties. | | `sliceFontStyle` | String | 'bold 16px Arial' | Font style for the slice text. | | `sliceTextPosition` | String | 'edge' | Position of the slice text. Can be 'edge', 'center' or 'middle'. | | `winnerIndex` | Number | 0 | Index of the slice that will be the winner. | | `spinDuration` | Number | 4000 | Duration of the spin animation in milliseconds. | | `cursorAngle` | Number | 0 | Angle of the cursor. | | `cursorPosition` | String | 'edge' | Position of the cursor. Can be 'edge' or 'center'. | | `cursorDistance` | Number | 0 | Distance of the cursor from the center or edge. It's depending to cursorPosition | | `sounds` | Object | {} | Object of sound files. | | `sounds.won` | String | null | Sound file for the winning event. | | `sounds.spinning` | String | null | Sound file for the spinning event. | ## Slots | Slot | Description | |--------------|------------------------------------------------------------| | `cursor` | Slot for the cursor element. Mostly an image like a cursor | | `default` | Slot for centered content. Mostly a circle spin button | ## Events | Event | Description | |---------------|---------------------------------------------------------------------| | `spin-start` | Emitted when the spin starts. | | `spin-end` | Emitted when the spin ends. Passes the `winnerIndex` as a parameter.| ## License This project is licensed under the MIT License. Sponsored by [offday.app](https://trustlocale.com "Discover the best days off to maximize your holiday!") Sponsored by [uptimetick.com](https://uptimetick.com "Your alternate uptime monitor")