# Card Swiper ## Example ```svelte
({ title: `Card ${i}`, description: `Card ${i} description`, image: profiles[i % profiles.length] })} bind:swipe >
``` ## Documentation ## Usage ```svelte
({ title: `Card ${i}`, description: `Card ${i} description`, image: profiles[i % profiles.length] })} >
``` ## API Reference ### CardSwiper A Tinder-style swipeable card stack with touch and keyboard support. | Prop | Type | Default | Description | |------|------|---------|-------------| | cardData | `(index: number) => CardData` | `-` | A function that returns card data for a given index. CardData: { title?: string; description?: string; image?: string; [key: string]: unknown }. (required) | | card | `Snippet<[CardData]>` | `-` | A custom snippet for rendering each card. Receives the card data as a parameter. Uses a default card template if not provided. | | onswipe | `(event: { direction: 'left' | 'right'; data: CardData; index: number; element: HTMLElement }) => void` | `-` | Callback invoked when a card is swiped away. | | swipe | `(direction: 'left' | 'right') => void` | `-` | A function to programmatically trigger a swipe. Bind to this to control swiping from outside. (bindable) | | minSwipeDistance | `number` | `0.5` | Minimum swipe distance (as a fraction of card width) to trigger a swipe. | | minSwipeVelocity | `number` | `0.5` | Minimum swipe velocity to trigger a swipe. | | arrowKeys | `boolean` | `true` | Whether arrow keys trigger swipes. | | thresholdPassed | `number` | `0` | A reactive value (-1 to 1) indicating how far past the swipe threshold the current card is. Negative for left, positive for right. (bindable) | | anchor | `number | null` | `-` | The vertical anchor point of rotation during swipe (as a fraction of card height). null disables rotation anchoring. | | rotate | `boolean` | `true` | Whether cards rotate during swipe. | | cardCount | `number` | `5` | The number of cards to render in the stack. |