Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@slipmatio/control-knob

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slipmatio/control-knob

Rotary control knob component for Vue 3 that behaves like native audio app controls in Logic Pro or Ableton Live. Component is fully customizable and rendered as an ARIA-friendly SVG element.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Vue Control Knob

Rotary control knob component for Vue 3 that behaves like native audio app controls in Logic Pro or Ableton Live. Component is fully customizable and rendered as an ARIA-friendly SVG element.

Screenshot Screenshot

Features:

  • Supports keyboard, mouse & wheel control
  • Changes input only with vertical mouse movement
  • Precice mode using shift + movement
  • Reset to default with Option-click (alt-click)
  • Zero dependencies (apart from Vue 3)
  • Fully configurable and Tailwind CSS -friendly styles
  • Witten in TypeScript, ships with typings

Installation

  1. Install the package from npm: yarn add @slipmatio/control-knob
  2. Import Vue component to your project: import ControlKnob from '@slipmatio/control-knob
  3. Configure v-model and options

Configuration

All configuration options are optional. The options referencing inner coordinate positions are based on 100x100 coordinate system that is not affected by the imageSize.

OptionDefaultDescription
imageSize40Rendered SVG width and lenght in pixels.
minValue0Minimum value of the knob v-model.
maxValue100Maximum value of the knob v-model.
showTicktrueShow visible marker of the knob position.
showValuetrueShow value label inside the knob.
hideDefaultValuefalseHide value label if value hasn't been changed.
tickLength18Tick length in pixels.
tickOffset10Tick offset in pixels.
tickStroke3Tick stroke width.
rimStroke11Outer rim stroke width.
valueArchStroke11Value arch stroke width.
bgRadius34Radius of the background circle.
wheelFactor10Modifier to factor any mousewheel ticks.
keyFactor10Modifier to factor any arrow-key presses.
tabIndex0Tabindex for the HTML element.
ariaLabel'Knob'ARIA label for the HTML element.
valueTextX50X-position of the value text label.
valueTextY62Y-position of the value text label.
svgClass'select-none'CSS class for the SVG element.
bgClass'text-[#868686]'CSS class for the background circle.
rimClass'text-[#393939]'CSS class for the outer rim.
valueArchClass'text-[#53d769]'CSS class for the value arch.
tickClass'text-black'CSS class for the tick line.
valueTextClass'text-gray-50 text-[30px] font-normal font-mono'CSS class for the value text.

Note that if you're using Tailwind CSS with automatic purge, you'll probably want to add the default classes as options so PurgeCSS catches them (or you can just whutelist them):

Default Tailwind CSS classes:

const options = {
  svgClass: 'select-none',
  bgClass: 'text-[#868686]',
  rimClass: 'text-[#393939]',
  valueArchClass: 'text-[#53d769]',
  tickClass: 'text-black',
  valueTextClass: 'text-gray-50 text-[30px] font-normal font-mono',
}

Development

Install dependencies

yarn

Run development server

yarn dev

Run tests

yarn test

Contributing

Contributions are welcome! Please follow the code of conduct when interacting with others.

Elsewhere

Follow @uninen on Twitter

Keywords

FAQs

Package last updated on 27 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc