Krizaka
Documentation

Swipe deck

Cards decided one by one — drag right to like, left to pass, or the buttons (← → on the web) — with PersonCard: a person's photos, name, age, seal, distance, bio and interests.

Web + MobileBetaData display

Web and mobile — the same component for React and React Native. Beta: its API may still change in a minor version.

When to use

  • Discover in a dating app: like or pass, one profile at a time.
  • Any one-by-one decision: approve or reject, keep or skip.

When not to use

  • To browse many items side by side.Use instead: List

Installation

Install

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { SwipeDeck, PersonCard } from "@krizaka/ui/swipe-deck";

Examples

Discover

Two profiles, photos to page through, the deck decided by drag, buttons or keys.

Elena 29

3.2 km away

Sunsets, vinyl and long walks.

MusicSurf

Props

PersonCard

A person on a card: photos full bleed (a side to change), name and age over a scrim, a line, a bio, chips.

PropTypeDefaultDescription
namerequiredstring—The name.
photosrequiredreadonly { src: string; alt?: string | undefined; }[]—The person's photos (URLs), the first shown first; click a side, or its buttons, to move between them.
agenumber—The age, written after the name.
badgeReactNode—Beside the name: a VerifiedBadge.
biostring—A sentence about the person.
classNamestring—Classes merged on the card.
footerReactNode—At the bottom: the interests as chips.
metaReactNode—A line under the name: a distance, a job.
photoLabels{ previous: string; next: string; }{ previous: "Previous photo", next: "Next photo" }The photo buttons' words: { previous: "Previous photo", next: "Next photo" } — passed translated.

SwipeDeck

A deck of cards decided one by one: drag, the buttons, or ← → — each decision announced.

PropTypeDefaultDescription
getIdrequired(item: T) => string—A card's id.
getNamerequired(item: T) => string—A card's name, for the announcements.
itemsrequiredreadonly T[]—The cards still to decide, the first on top.
labelsrequiredSwipeDeckLabels—The words, passed translated.
onSwiperequired(item: T, direction: SwipeDirection) => void—Called with the card decided and the decision; remove it from items.
renderCardrequired(item: T) => ReactNode—A card (usually a PersonCard).
classNamestring—Classes merged on the root.
emptyReactNode—Shown when there is no card left (an EmptyState).

Accessibility

  • The top card is the only one exposed; the next waits hidden from assistive technology.
  • React Native offers Like and Pass as accessibility actions of the card.
  • Under reduced motion the card leaves without flying.

Keyboard

KeysAction
Arrow Right / Arrow LeftOn the focused deck: like or pass the top card.
TabReaches the card's photo buttons and the like and pass buttons.

Best practices

  • Remove the decided card from items in onSwipe; keep two or three loaded ahead.
  • Always keep the buttons: a swipe is never the only way.
  • Say the decision (decided) so a screen reader hears it.

Generated from the code of @krizaka/ui 3.5.0: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page