Input Type
The inputType option sets the input device types to enable as an array. You can allow or restrict specific input devices.
- JavaScript
- React
- Vue@3
Summary
Key Options
| Option | Type | Default | Description |
|---|---|---|---|
inputType | string[] | ["touch", "mouse"] | Input device types to enable |
Comparison by Value
| Value | Behavior | Suitable For |
|---|---|---|
["touch", "mouse"] | Both touch and mouse allowed (default) | General usage, cross-platform |
["touch"] | Touch only, mouse drag ignored | Touch-only UI, preventing mouse drag |
["mouse"] | Mouse only, touch ignored | Desktop-only UI |
Details
How inputType Works
Only the input types included in the array are used for Flicking interaction. Input types not included are ignored.
// Allow all input (default)
inputType: ["touch", "mouse"]
// Touch only
inputType: ["touch"]
// Mouse only
inputType: ["mouse"]
// Disable all input
inputType: []
Supported Input Types
"touch": Touchscreen input (smartphones, tablets)"mouse": Mouse drag input (desktop)
iOSEdgeSwipeThreshold
In iOS Safari, swiping from the edge of the screen triggers the browser's back/forward navigation gesture. The iOSEdgeSwipeThreshold option specifies the width (px) of this area, so touches starting within that range are passed to the browser instead of being handled by Flicking.
const flicking = new Flicking("#el", {
inputType: ["touch", "mouse"],
iOSEdgeSwipeThreshold: 30 // Default: 30px area on each side is deferred to browser gestures
});
iOSEdgeSwipeThreshold only works on iOS devices. The default value (30px) is generally sufficient. For full-screen horizontal sliders where edge panels are frequently dragged, you can reduce the value or set it to 0.
Related Options
- Relationship with disableOnInit:
disableOnInit: truedisables all input, andinputType: []has the same effect. The difference is that disableOnInit can be later activated withenable().
Use Cases
- ["touch", "mouse"]: General web apps, supporting various devices
- ["touch"]: Mobile-only UI, when you want only button/arrow control on desktop
- ["mouse"]: Desktop-only apps, when touch input is used for other purposes
Notes
Restricting certain input types means users on those devices cannot interact. Provide alternatives such as navigation buttons or keyboard controls.
Generally, using the default ["touch", "mouse"] is recommended from an accessibility standpoint. Do not restrict input types without a specific reason.
Related Links
Related Options
disableOnInit: Disable input on initializationiOSEdgeSwipeThreshold: iOS edge swipe exclusion area width
Related Demos
- Disable Input: Disabling input