Spectra Slider
Customize
Props
| Property | Type | Default | Description |
|---|---|---|---|
cards | Card[] | [] | Array of card objects. Each card: { id, image?: string, content?: ReactNode }. If empty, fallback demo cards are shown. |
numberOfCards | number | 7 | Number of cards to display (min 3). Slices from the cards array or fallback demo cards. |
cardWidth | number | 220 | Width of each card in pixels. |
cardHeight | number | 340 | Height of each card in pixels. |
gap | number | 190 | Horizontal distance between card centers in pixels. |
perspective | number | 1200 | CSS perspective (in pixels) applied to the stage, controls how strong the 3D depth effect looks. |
maxRotation | number | 35 | Maximum rotateY tilt (in degrees) applied to the furthest visible cards. |
scaleStep | number | 0.14 | How much each card shrinks per step away from the centered card. |
opacityStep | number | 0.28 | How much each card fades per step away from the centered card. |
brightnessStep | number | 0.35 | How much each card darkens (CSS brightness filter) per step away from the centered card. |
draggable | boolean | true | Enable drag to move through the cards. |
snap | boolean | true | Snap to the nearest card when a drag or wheel scroll ends. |
initialIndex | number | 0 | Index of the card centered on mount. |
autoPlay | boolean | false | Automatically cycles through the cards on a continuous loop. |
duration | number | 20 | Seconds for one full autoplay loop through every card. |
reverse | boolean | false | Reverses the autoplay direction. |
pauseOnHover | boolean | true | Pauses autoplay while the pointer is hovering over the stage. |
wheelSmoothness | number | 0.15 | Lerp factor (0-1) for wheel-driven movement — lower values feel smoother/slower to catch up to the scroll target. |
wheelSensitivity | number | 0.008 | Multiplier converting wheel deltaY into offset movement. |
mouseWheel | boolean | true | Enables scrolling through cards with the mouse wheel / trackpad. |
filterOnHover | boolean | false | Toggles a grayscale/contrast filter on a card when it is hovered. |
defaultFiltered | boolean | false | When filterOnHover is enabled, controls whether cards start filtered (and clear on hover) or start clear (and filter on hover). |
direction | 'horizontal' | 'vertical' | 'horizontal' | Layout axis for the stack — cards spread vertically or horizontally. |
curveIntensity | number | -20 | Perpendicular arc offset applied per step away from center (offset * diff²). Positive/negative flips the curve side; 0 keeps the stack flat. |
entranceAnimation | boolean | true | Plays a one-time entrance animation for the cards on mount. |
entranceDuration | number | 0.9 | Duration (in seconds) of the entrance animation. |
entranceStagger | number | 0.07 | Delay (in seconds) between each card’s entrance animation. |
entranceEase | string | "back.out(1.4)" | GSAP easing function used for the entrance animation. |
entranceType | string | "spin" | Entrance animation style: pop | fade | bottom | top | left | right | flip | scatter | spin | zoomBlur. |
onCardClick | (card: Card, index: number) => void | undefined | Callback fired when the centered card is clicked. Clicking an off-center card instead animates it to center. |
className | string | "" | Additional CSS classes for the stage container. No background is applied by the component itself. |
cardClassName | string | "" | Additional CSS classes for individual cards. |
cardsCard[]Array of card objects. Each card: { id, image?: string, content?: ReactNode }. If empty, fallback demo cards are shown.
[]numberOfCardsnumberNumber of cards to display (min 3). Slices from the cards array or fallback demo cards.
7cardWidthnumberWidth of each card in pixels.
220cardHeightnumberHeight of each card in pixels.
340gapnumberHorizontal distance between card centers in pixels.
190perspectivenumberCSS perspective (in pixels) applied to the stage, controls how strong the 3D depth effect looks.
1200maxRotationnumberMaximum rotateY tilt (in degrees) applied to the furthest visible cards.
35scaleStepnumberHow much each card shrinks per step away from the centered card.
0.14opacityStepnumberHow much each card fades per step away from the centered card.
0.28brightnessStepnumberHow much each card darkens (CSS brightness filter) per step away from the centered card.
0.35draggablebooleanEnable drag to move through the cards.
truesnapbooleanSnap to the nearest card when a drag or wheel scroll ends.
trueinitialIndexnumberIndex of the card centered on mount.
0autoPlaybooleanAutomatically cycles through the cards on a continuous loop.
falsedurationnumberSeconds for one full autoplay loop through every card.
20reversebooleanReverses the autoplay direction.
falsepauseOnHoverbooleanPauses autoplay while the pointer is hovering over the stage.
truewheelSmoothnessnumberLerp factor (0-1) for wheel-driven movement — lower values feel smoother/slower to catch up to the scroll target.
0.15wheelSensitivitynumberMultiplier converting wheel deltaY into offset movement.
0.008mouseWheelbooleanEnables scrolling through cards with the mouse wheel / trackpad.
truefilterOnHoverbooleanToggles a grayscale/contrast filter on a card when it is hovered.
falsedefaultFilteredbooleanWhen filterOnHover is enabled, controls whether cards start filtered (and clear on hover) or start clear (and filter on hover).
falsedirection'horizontal' | 'vertical'Layout axis for the stack — cards spread vertically or horizontally.
'horizontal'curveIntensitynumberPerpendicular arc offset applied per step away from center (offset * diff²). Positive/negative flips the curve side; 0 keeps the stack flat.
-20entranceAnimationbooleanPlays a one-time entrance animation for the cards on mount.
trueentranceDurationnumberDuration (in seconds) of the entrance animation.
0.9entranceStaggernumberDelay (in seconds) between each card’s entrance animation.
0.07entranceEasestringGSAP easing function used for the entrance animation.
"back.out(1.4)"entranceTypestringEntrance animation style: pop | fade | bottom | top | left | right | flip | scatter | spin | zoomBlur.
"spin"onCardClick(card: Card, index: number) => voidCallback fired when the centered card is clicked. Clicking an off-center card instead animates it to center.
undefinedclassNamestringAdditional CSS classes for the stage container. No background is applied by the component itself.
""cardClassNamestringAdditional CSS classes for individual cards.
""Dependencies
Crafted withbyMohammad Tasin
