Vue API Reference

Complete reference for @reelkit/vue components, composables, and utilities.

Reel

Tag: <Reel>

Props

PropTypeDefaultDescription
countnumberrequiredTotal number of slides
direction'vertical' | 'horizontal''vertical'Scroll direction
size[number, number] | undefinedundefinedWidth and height as [width, height]. When omitted, auto-measures via ResizeObserver
initialIndexnumber0Starting slide index
loopbooleanfalseEnable infinite loop
transitionTransitionTransformFnslideTransitionTransition effect function. Built-in: slideTransition, fadeTransition, flipTransition, cubeTransition, zoomTransition
transitionDurationnumber300Animation duration in ms
swipeDistanceFactornumber0.12Swipe threshold (0-1)
enableGesturesbooleantrueEnable touch/mouse drag navigation
enableNavKeysbooleantrueEnable keyboard arrow key navigation
enableWheelbooleanfalseEnable mouse wheel navigation
wheelDebounceMsnumber200Wheel event debounce in ms
rangeExtractor(index: number, count: number) => number[]defaultRangeExtractorCustom function to determine which indexes are rendered
keyExtractor(index: number, indexInRange: number) => stringindex => index.toString()Custom key function for slide rendering (useful with loop)
ariaLabelstringundefinedAccessible label for the carousel region
reelStyleRecord<string, string | number>undefinedInline styles applied to the root container element
reelClassstring | Array | ObjectundefinedCSS class(es) applied to the root container element
onNavKeyPress(increment: -1 | 1) => voidundefinedCallback prop that replaces the default ArrowUp/ArrowDown navigation. When provided, you implement your own navigation (e.g. call reelRef.value.next()). Omit for default behavior.

Events

EventPayloadDescription
beforeChange(index: number, nextIndex: number, indexInRange: number)Emitted before slide transition begins
afterChange(index: number, indexInRange: number)Emitted after slide transition completes
slideDragStart(index: number)Emitted when a drag gesture starts
slideDragEnd(index: number)Emitted when a drag gesture ends (released)
slideDragCanceled(index: number)Emitted when a drag gesture is canceled (snap-back)
tap(event: GestureCommonEvent)Emitted on a single tap gesture
doubleTap(event: GestureCommonEvent)Emitted on a double tap gesture
longPress(event: GestureCommonEvent)Emitted when a long press gesture starts
longPressEnd(event: GestureEvent)Emitted when a long press gesture ends

Slots

vue-html
SlotScoped PropsDescription
#item{ index: number, indexInRange: number, size: [number, number] }Renders each visible slide. Called for each index in the virtualized range
defaultnoneOverlay content rendered on top of all slides (indicators, controls, etc.)

ReelExpose

Imperative API exposed via template ref:

vue
MethodTypeDescription
next()() => voidGo to next slide
prev()() => voidGo to previous slide
goTo(index, animate?)(number, boolean?) => Promise<void>Navigate to a specific slide index
adjust()() => voidRecalculate slide positions (useful after layout change)
observe()() => voidStart listening to gesture, keyboard, and wheel events
unobserve()() => voidStop listening to gesture, keyboard, and wheel events

ReelIndicator

Tag: <ReelIndicator>

Props

PropTypeDefaultDescription
countnumber | undefinedautoTotal number of items. Auto-connected from parent Reel context when nested inside one; pass explicitly when used standalone
activenumber | undefinedautoCurrent active index. Auto-connected from parent Reel context when nested inside one; pass explicitly when used standalone
direction'vertical' | 'horizontal''vertical'Indicator orientation
radiusnumber3Dot radius in pixels
visiblenumber5Max normal-sized dots visible at once
gapnumber4Space between dots in pixels
activeColorstring'#fff'Active dot color
inactiveColorstring'rgba(255, 255, 255, 0.5)'Inactive dot color
edgeScalenumber0.5Scale factor for edge overflow dots
onDotClick(index: number) => voidundefinedCustom click handler. When omitted inside a Reel, defaults to navigating to the clicked dot index
indicatorClassstring | Array | ObjectundefinedCSS class(es) applied to the tablist root element
indicatorStyleCSSPropertiesundefinedInline styles merged into the tablist root element

Events

EventPayloadDescription
dotClick(index: number)Emitted when a dot is clicked; provides the dot index

SwipeToClose

Tag: <SwipeToClose> — Wraps its default slot in a touch-aware container that can be swiped to dismiss.

Props

PropTypeDefaultDescription
direction'up' | 'down'requiredSwipe direction to trigger close. Use "up" for lightbox dismiss, "down" for stories dismiss
enabledbooleantrueWhether the swipe-to-close gesture is active
thresholdnumber0.2Fraction of viewport height required to trigger close (0-1)

Events

EventPayloadDescription
close()Emitted when the swipe gesture exceeds the threshold and the close animation completes

Slots

SlotDescription
defaultContent to wrap with swipe-to-close gesture handling

RK_REEL_KEY & useReelContext

An InjectionKey<ReelContextValue> provided by <Reel> to its descendants. Used internally by <ReelIndicator> for auto-connect behavior. Use useReelContext() in custom components that need slider context.

vue
PropertyTypeDescription
indexSignal<number>Reactive current slide index
countSignal<number>Reactive total item count
goTo(index: number, animate?: boolean) => Promise<void>Programmatically navigate to a slide

Composables

useBodyLock

Locks the document body scroll when the provided value is true. Uses reference counting so multiple concurrent callers can each lock/unlock independently. Automatically unlocks on unmount.

typescript
ParameterTypeDescription
lockedRef<boolean> | booleanWhether body scroll should be locked. Accepts a reactive ref or a static boolean

useFullscreen

Composable for managing the Fullscreen API with cross-browser support. Exits fullscreen automatically on unmount.

typescript
ReturnTypeDescription
isFullscreenSignal<boolean>Core signal reflecting current fullscreen state (read .value)
request() => Promise<void>Request fullscreen on the referenced element. If another element is already fullscreen, it is exited first (awaited).
exit() => Promise<void>Exit fullscreen
toggle() => Promise<void>Toggle fullscreen state

useSoundState

Access the current SoundController from context. Must be called inside a <SoundProvider>. Throws if called outside.

typescript

toVueRef

Bridges a core Subscribable (any Signal from @reelkit/core) into a read-only Vue Ref. Use it whenever you need a core signal value to drive a Vue re-render — direct signal.value reads in render functions or templates are not reactive on their own.

The subscription is auto-disposed via onScopeDispose, so this must be called inside a Vue setup() or other effect-scope-aware context.

typescript

SoundProvider

Tag: <SoundProvider> — Context provider that creates a SoundController instance and provides it to descendants via RK_SOUND_KEY. Renders its default slot transparently.

vue

Accessibility

<Reel> renders as role="region" with aria-roledescription="carousel". Pass aria-label (the prop is ariaLabel in TS) to give the region a screen-reader name. A polite live region announces "Slide N of M" on every slide change. Inactive slides receive the inert attribute so focus and AT navigation skip them.

<ReelIndicator> renders as role="tablist" with roving tabindex on the dots; arrow keys move focus and Enter or Space activates the slide.

Building a custom modal around <Reel>? captureFocusForReturn, createFocusTrap, and getFocusableElements are re-exported from @reelkit/vue for focus return and trap.

Package Exports

All public exports from @reelkit/vue:

typescript