Skip to main content

Vertical

The horizontal option sets the direction of panel movement. When true, panels move horizontally (left/right); when false, panels move vertically (up/down).

import Flicking from "@egjs/flicking";
import "@egjs/flicking/dist/flicking.css";
import "./styles.css";

// horizontal: true (default)
new Flicking("#flick-horizontal", {
  horizontal: true,
  align: "prev",
  bound: true
});

// horizontal: false (vertical)
// In vanilla JS, you must add the "vertical" class
// to the flicking-viewport element manually.
// React and Vue wrappers add it automatically.
new Flicking("#flick-vertical", {
  horizontal: false,
  align: "prev",
  bound: true
});

Summary

Key Options

OptionTypeDefaultDescription
horizontalbooleantruePanel movement direction (true: horizontal, false: vertical)

Comparison by Value

ValueBehaviorSuitable For
trueDrag left/right to move panelsGeneral carousels, image galleries, banner sliders
falseDrag up/down to move panelsVertical card stacks, story viewers, vertical onboarding

Details

horizontal: true in Detail

This is the default. Panels are arranged horizontally, and users move panels by dragging left/right. Used in most carousel UIs.

horizontal: false in Detail

Panels are arranged vertically, and users move panels by dragging up/down. Suitable for vertical scroll UIs or fullscreen story viewers.

Important: In vertical mode, a fixed height must be set on the viewport. Without a height, panels will not be visible.

.flicking-viewport {
height: 300px; /* Required in vertical mode */
}

Vanilla JS only: You must manually add the vertical class to the viewport element. React and Vue wrappers add this class automatically.

<!-- Vanilla JS: "vertical" class is required -->
<div id="my-flicking" class="flicking-viewport vertical">
<div class="flicking-camera">
<div class="panel">1</div>
<div class="panel">2</div>
</div>
</div>

This class changes the camera's flex-direction to column, enabling vertical panel layout.

  • Relationship with adaptive: The adaptive option only works when horizontal: true. It has no effect in vertical mode.
  • Relationship with nested: If parent and child Flicking have different horizontal values, it works naturally without the nested option.
  • Relationship with inputType: The default inputType ["mouse", "touch"] supports both horizontal and vertical.

Use Cases

When to use?
  • horizontal: true: Image galleries, product sliders, banners, tab-style UI
  • horizontal: false: TikTok/Instagram Stories style, vertical card stacks, fullscreen onboarding

Notes

Viewport height required in vertical mode

When setting horizontal: false, panels will not be displayed if a fixed height is not set on the viewport. Make sure to set a height value in CSS.

Scroll conflict on touch devices

In vertical mode, up/down dragging may conflict with page scrolling. If necessary, review the preventDefaultOnDrag option or CSS touch-action settings.

  • adaptive: Adjust viewport to panel height (horizontal: true only)
  • nested: Nested Flicking behavior
  • inputType: Input type settings
  • Nested: Nested Flicking (nested not needed for different directions)
  • Adaptive: Panel height adaptation