Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

CardSwap

card-swap

Cycles stacked cards through animated front-to-back swaps.

Usage

Basic usage

Wrap each card with CardSwap.Card, at least 2 cards will be automatically rotated; placement="center" allows the entire stack to be framed into the container.

Hulian Card Shuffling

3D Pivot stacking · Automatic rotation · Zero external dependencies

Real-time synchronization

Millisecond-level status push, consistent across terminals.

Visual Orchestration

Drag and drop to build complex business pipelines.

Permission Kernel

Field-level access control, out of the box.

tsx
<div
  className="relative h-96 overflow-hidden rounded-xl"
  style={{ background: "oklch(0.16 0.02 255)" }}
>
  <CardSwap width={300} height={200} placement="center">
    <CardSwap.Card>Real-time synchronization</CardSwap.Card>
    <CardSwap.Card>Visual Arrangement</CardSwap.Card>
    <CardSwap.Card>Permission Kernel</CardSwap.Card>
  </CardSwap>
</div>

Smooth and easing motion

easing="smooth" removes the elastic rebound and makes the rhythm more restrained, suitable for enterprise scenarios.

Hulian Card Shuffling

3D Pivot stacking · Automatic rotation · Zero external dependencies

Real-time synchronization

Millisecond-level status push, consistent across terminals.

Visual Orchestration

Drag and drop to build complex business pipelines.

Permission Kernel

Field-level access control, out of the box.

tsx
<CardSwap
  width={300}
  height={200}
  placement="center"
  easing="smooth"
  skewAmount={4}
  delay={2600}
>
  {cards}
</CardSwap>

Compact fit (no tilt)

Adjust cardDistance / verticalDistance to make the stack more compact, skewAmount={0} has no tilt when viewed from the front.

Hulian Card Shuffling

3D Pivot stacking · Automatic rotation · Zero external dependencies

Real-time synchronization

Millisecond-level status push, consistent across terminals.

Visual Orchestration

Drag and drop to build complex business pipelines.

Permission Kernel

Field-level access control, out of the box.

tsx
<CardSwap
  width={300}
  height={190}
  placement="center"
  cardDistance={32}
  verticalDistance={40}
  skewAmount={0}
  delay={2800}
>
  {cards}
</CardSwap>

When to use

Use CardSwap for an automatically cycling perspective stack in a marketing edge composition or centered gallery. Use BounceCards for a static fanned entrance or ChromaGrid for spotlight reveal. Use <CardSwap.Card> for the built-in skin or any custom element; at least two cards are required to cycle.

Import

ts
import { CardSwap } from "@hulianui/ui"

Props

NameTypeDefaultDescription
widthnumber380Card width in pixels.
heightnumber280Card height in pixels.
cardDistancenumber56Horizontal and depth separation.
verticalDistancenumber64Vertical step distance.
delaynumber5000Cycle interval in milliseconds.
pauseOnHoverbooleanfalseWhether hover pauses cycling.
skewAmountnumber5skewY depth angle in degrees.
easing"elastic" | "smooth""elastic"Bouncy or restrained transition.
placement"bottom-right" | "center""bottom-right"Edge-overflow marketing layout or fully visible centered stack.
classNamestring-Root class name.
styleCSSProperties-Root inline styles.

Events

EventTypeDescription
onCardClick(index: number) => voidReports the clicked child's original index.

Slots

SlotTypeDescription
childrenReactNodeCards, preferably <CardSwap.Card>; two or more are needed for cycling.

Example

tsx
<div className="relative h-96 overflow-hidden rounded-xl">
  <CardSwap width={300} height={200} delay={3000} placement="center" pauseOnHover>
    <CardSwap.Card><p className="text-sm font-semibold">Real-time sync</p><p className="mt-2 text-xs">Millisecond updates across devices.</p></CardSwap.Card>
    <CardSwap.Card>...</CardSwap.Card><CardSwap.Card>...</CardSwap.Card>
  </CardSwap>
</div>

Smooth restrained motion:

tsx
<CardSwap easing="smooth" skewAmount={4} placement="center" delay={2600}>{cards}</CardSwap>

Usage guidelines

  • The default bottom-right placement intentionally overflows. Use center in ordinary gallery containers.
  • One card remains static.
  • delay is milliseconds, and the parent needs relative positioning and overflow clipping.
  • Reduced motion stops automatic cycling.

Related

Table · Book3D · ProTable · PricingTable · JsonViewer · EditableTable

Playground

Hulian Card Shuffling

3D Pivot stacking · Automatic rotation · Zero external dependencies

Real-time synchronization

Millisecond-level status push, consistent across terminals.

Visual Orchestration

Drag and drop to build complex business pipelines.

Permission Kernel

Field-level access control, out of the box.

<div className="relative h-96 overflow-hidden rounded-xl"
     style={{ background: "oklch(0.16 0.02 255)" }}>
  <CardSwap
    width={300}
    height={200}
    placement="center"
    delay={3000}
    cardDistance={56}
    verticalDistance={64}
    skewAmount={5}
    easing="elastic"
    pauseOnHover={true}
  >
    <CardSwap.Card>Real-time synchronization</CardSwap.Card>
    <CardSwap.Card>Visual Arrangement</CardSwap.Card>
    <CardSwap.Card>Permission Kernel</CardSwap.Card>
  </CardSwap>
</div>
PreviousBounceCardsData DisplayNextChromaGrid

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage guidelines
    • Related
  • Playground