Skip to content

Demo app for Vue.js chooser component that scrolls horizontally, with some inertia.

License

Notifications You must be signed in to change notification settings

clutterstack/chooser-horiz-scroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chooser-horiz-scroll

A Vue.js component for selecting a value from an array, displayed horizontally and scrollable if the rendered row of items is larger than the containing <div>.

Does not work on mobile in its current state, because it uses mouse events.

This repo wraps the component in a test Vue app to make it easy to demonstrate. Live demo with further details lives at chrisnicoll.net.

Props

Takes an array of values (targets) as a prop. Emits one of two custom events, depending on whether a value received a full click or just a mousedown. Both events carry the value as a payload. This allows, for example, either selecting the value or "dragging" it to another component and doing something with it there.

In the demo, these events are treated as a selection and a tentative selection.

There is another prop (mouseOutOfBounds), that is watched by the component and is treated the same as a mouseup on its document. It is used by the demo app to indicate that the mouse has left its root element, which allows more predictable behaviour when embedded using <object> or <iframe> in another page (such as the demo post linked above).

Animation

There is some "physics" to allow the chooser to be "thrown" and to bounce off the end of its travel. Animation parameters are set in the component's data option.

About

Demo app for Vue.js chooser component that scrolls horizontally, with some inertia.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published