https://github.com/victorqribeiro/dial
A Rotary Dial menu for input numbers
https://github.com/victorqribeiro/dial
dial gui javascript menu rotary rotary-dial rotary-phone ui ux
Last synced: 8 days ago
JSON representation
A Rotary Dial menu for input numbers
- Host: GitHub
- URL: https://github.com/victorqribeiro/dial
- Owner: victorqribeiro
- License: mit
- Created: 2019-10-12T17:36:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T15:47:32.000Z (over 5 years ago)
- Last Synced: 2025-03-30T23:11:15.212Z (about 1 month ago)
- Topics: dial, gui, javascript, menu, rotary, rotary-dial, rotary-phone, ui, ux
- Language: JavaScript
- Homepage: https://victorribeiro.com/dial
- Size: 43 KB
- Stars: 167
- Watchers: 5
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Rotary Dial
A [Rotary Dial](https://en.wikipedia.org/wiki/Rotary_dial) for input numbers.

Live version [here](https://victorribeiro.com/dial) | Alternative link [here](https://victorqribeiro.github.io/dial/index.html)
# How to use it
Click / Touch the disc and drag it until the arrow. When the number reaches the arrow, it will turn red, then let go and that's your number.
# How to use it on your web app
Include the RotaryDial.js file.
```html
```
Then create a new RotaryDial
```javascript
const rd = new RotaryDial();
```Creating a callback is easy, just define what your function will do with the number it receives from the RotaryDial.
```javascript
const func = function(number){
alert( number )
}const rd = new RotaryDial({callback: func});
```
By default the RotaryDial has the console.log function as the callback.
# Documentation
The RotaryDial accepts a configuration object on its constructor. The most import parts are the size and the callback. The size will determine the size of your rotary dial menu, and the callback determines which function will be called when a number is selected. Besides that, there are some color configurations you can fiddle with.
**size** - The size of the menu. *Default 400px*
**callback** - The function that will be called when a number is selected. *Default console.log*
**discFillColor** - The disc color.
**discStrokeColor** - The disc border color.
**circlesFillColor** - The circles (where the numbers are displayed) color.
**circlesStrokeColor** - The circles (where the numbers are displayed) border color.
**circlesHighlightColor** - The color that a circle will be displayed when a number is selected.
**textFillColor** - The text color.
**textStrokeColor** - The text border color.
**arrowFillColor** - The arrow color.
**arrowStrokeColor** - The arrow border color.