RiffleInstance
Defined in: react/Riffle.tsx:68
What riffleRef receives: imperative control and a read of the current
state. The same members as the Vue drop-in’s template ref. Reading
activeIndex or state here does not re-render anything; use onChange
for that.
Example
Section titled “Example”import { useRef } from 'react'import { Riffle, type RiffleInstance } from '@rpxl/riffle/react'
function Stack({ films }: { films: { title: string }[] }) { const riffleRef = useRef<RiffleInstance>(null) return ( <Riffle riffleRef={riffleRef} cards={films} cardWidth={300} cardHeight={400}> {(film) => <div>{film.title}</div>} </Riffle> )}Properties
Section titled “Properties”activeIndex
Section titled “activeIndex”
readonlyactiveIndex:number
Defined in: react/Riffle.tsx:80
The card currently at the front. Not reactive; read it, do not watch it.
instance
Section titled “instance”
readonlyinstance:Riffle|null
Defined in: react/Riffle.tsx:78
The live engine, or null before mount and after unmount.
on: <
K>(event,fn) => () =>void
Defined in: react/Riffle.tsx:76
Subscribes to one engine event. Returns an unsubscribe function.
Subscribes to one engine event. Returns an unsubscribe function; a no-op while unmounted.
Type Parameters
Section titled “Type Parameters”K extends keyof RiffleEventMap
Parameters
Section titled “Parameters”K
(payload) => void
Returns
Section titled “Returns”() => void
readonlystate:RiffleSnapshot
Defined in: react/Riffle.tsx:82
The full current snapshot. Not reactive; read it, do not watch it.
Methods
Section titled “Methods”goTo()
Section titled “goTo()”goTo(
index,opts?):void
Defined in: react/Riffle.tsx:74
Moves to index, animated unless opts.animate is false.
Parameters
Section titled “Parameters”number
animate?
Section titled “animate?”boolean
Returns
Section titled “Returns”void
next()
Section titled “next()”next():
void
Defined in: react/Riffle.tsx:70
Advances to the next card, with the spring’s animation.
Returns
Section titled “Returns”void
prev()
Section titled “prev()”prev():
void
Defined in: react/Riffle.tsx:72
Moves to the previous card, with the spring’s animation.
Returns
Section titled “Returns”void