RiffleProps<T>
Defined in: react/Riffle.tsx:100
Props for the <Riffle> drop-in. Every RiffleOptions key except count
(derived from cards.length) is a prop here too.
Example
Section titled “Example”import type { RiffleProps } from '@rpxl/riffle/react'
const films = [{ title: 'Neon Harbor' }]const props: RiffleProps<{ title: string }> = { cards: films, children: (film) => <div>{film.title}</div>,}Extends
Section titled “Extends”Omit<RiffleOptions,"count">.Omit<HTMLAttributes<HTMLDivElement>,"children"|"onChange"|"draggable">
Type Parameters
Section titled “Type Parameters”T
Properties
Section titled “Properties”
optionalaxis?:Axis
Defined in: types.ts:198
The drag axis. Default 'x'. Immutable after construction: update() throws on a change.
Inherited from
Section titled “Inherited from”bounds?
Section titled “bounds?”
optionalbounds?:Bounds
Defined in: types.ts:196
'loop' wraps past the ends, 'clamp' stops there. Default 'loop'.
Inherited from
Section titled “Inherited from”cardClassName?
Section titled “cardClassName?”
optionalcardClassName?:string
Defined in: react/Riffle.tsx:115
A class applied to every card element.
cardHeight?
Section titled “cardHeight?”
optionalcardHeight?:number|"auto"
Defined in: types.ts:190
Pixels, or 'auto' to measure a registered card. Default 400 when omitted as a number.
Inherited from
Section titled “Inherited from”cards: readonly
T[]
Defined in: react/Riffle.tsx:105
The cards to render. Each becomes one registered card, in order.
cardWidth?
Section titled “cardWidth?”
optionalcardWidth?:number|"auto"
Defined in: types.ts:188
Pixels, or 'auto' to measure a registered card. Default 300 when omitted as a number.
Inherited from
Section titled “Inherited from”children
Section titled “children”children: (
card,index) =>ReactNode
Defined in: react/Riffle.tsx:107
Renders one card’s content.
Parameters
Section titled “Parameters”T
number
Returns
Section titled “Returns”ReactNode
crossFollow?
Section titled “crossFollow?”
optionalcrossFollow?:number
Defined in: types.ts:212
How much the card follows the finger across the axis, 0..1. Default 0.18.
Inherited from
Section titled “Inherited from”draggable?
Section titled “draggable?”
optionaldraggable?:boolean
Defined in: types.ts:206
Whether dragging is enabled. Keyboard navigation stays on regardless. Default true.
Inherited from
Section titled “Inherited from”flingVelocity?
Section titled “flingVelocity?”
optionalflingVelocity?:number
Defined in: types.ts:202
Pixels per millisecond. Default 0.5.
Inherited from
Section titled “Inherited from”
optionalgap?:number
Defined in: types.ts:192
Pixels of space the default fan layout leaves between cards. Default 20.
Inherited from
Section titled “Inherited from”getKey?
Section titled “getKey?”
optionalgetKey?: (card,index) =>Key
Defined in: react/Riffle.tsx:109
Stable key per card. Defaults to the index; provide one for lists that reorder.
Parameters
Section titled “Parameters”T
number
Returns
Section titled “Returns”Key
getLabel?
Section titled “getLabel?”
optionalgetLabel?: (index) =>string
Defined in: types.ts:222
A caller-supplied label per card index. The card’s aria-label becomes
${getLabel(i)}, ${i + 1} of ${count}, and announcements use the same
string. Omit it for the bare position.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”layout?
Section titled “layout?”
optionallayout?:LayoutStrategy
Defined in: types.ts:216
The pose strategy. Default fan().
Inherited from
Section titled “Inherited from”maxVisible?
Section titled “maxVisible?”
optionalmaxVisible?:number
Defined in: types.ts:194
How many cards behind the front one stay visible before fading out. Default 4.
Inherited from
Section titled “Inherited from”onChange?
Section titled “onChange?”
optionalonChange?: (event) =>void
Defined in: react/Riffle.tsx:111
Fires whenever the active index changes, whether from a drag, a button, or goTo().
Parameters
Section titled “Parameters”direction
Section titled “direction”-1 | 1
number
previousIndex
Section titled “previousIndex”number
Returns
Section titled “Returns”void
reducedMotion?
Section titled “reducedMotion?”
optionalreducedMotion?:ReducedMotionMode
Defined in: types.ts:214
Whether to honour prefers-reduced-motion. Default 'auto'.
Inherited from
Section titled “Inherited from”
optionalref?:Ref<HTMLDivElement>
Defined in: react/Riffle.tsx:117
The root element. Composed with Riffle’s own root ref; see the Riffle doc comment.
riffleRef?
Section titled “riffleRef?”
optionalriffleRef?:Ref<RiffleInstance|null>
Defined in: react/Riffle.tsx:113
Receives the imperative handle, for controls such as external next and prev buttons.
rotation?
Section titled “rotation?”
optionalrotation?:false|RotationOptions
Defined in: types.ts:210
Tilt while dragging, or false to disable it. Default the RotationOptions defaults.
Inherited from
Section titled “Inherited from”spring?
Section titled “spring?”
optionalspring?:SpringPreset|SpringConfig
Defined in: types.ts:208
A named preset, or your own stiffness and damping. Default { stiffness: 340, damping: 34 }.
Inherited from
Section titled “Inherited from”startIndex?
Section titled “startIndex?”
optionalstartIndex?:number
Defined in: types.ts:204
The active card at construction. Read once; call goTo to move later. Default 0.
Inherited from
Section titled “Inherited from”threshold?
Section titled “threshold?”
optionalthreshold?:number
Defined in: types.ts:200
Fraction of one step, 0..1. Default 0.25.