The DefaultCard component is the built-in tour card UI that displays tour content, navigation controls, and progress indicator. It can be replaced with a custom component via the customCard prop in TourMachine.
Tailwind CSS Requirement
Important : The DefaultCard component requires Tailwind CSS v4 to render properly. Add this to your global CSS file:
Copy /* In your global.css or app.css */
@ source '../../node_modules/Tourista/dist/**/*.{js,mjs}' ; If you don't want to use Tailwind CSS, you should provide a custom card component instead.
The DefaultCard is used automatically by TourMachine. To use a custom card instead:
Copy import { TourMachine } from ' Tourista ' ;
import { CustomCard } from ' ./CustomCard ' ;
< TourMachine customCard = { CustomCard } />; Props (CardProps Interface)
All props are passed automatically by the tour system to any card component (default or custom).
The title text for the current tour step.
The content/description text for the current tour step.
currentStepIndex
The zero-based index of the current step.
The total number of steps in the tour.
Whether the user can navigate to the next step.
Whether the user can navigate to the previous step.
Whether the user can skip the tour at this step.
Type : boolean | undefined
Function to navigate to the next step.
Function to navigate to the previous step.
Function to skip/exit the tour.
Function to properly end the tour (used on last step).
Optional CSS class name for custom styling.
Optional inline styles to apply to the card container.
Type : React.CSSProperties | undefined
Whether to show navigation controls (prev/next buttons).
Type : boolean | undefined
Default Card Features
Visual indicator showing tour progress:
Blue fill indicates completed percentage
Smooth animation between steps
Shows (current step) of (total steps) text
Previous : Disabled when canGoPrev is false
Next : Shows when not on the last step or when can still go forward
Finish : Shows on the last step when canGoNext is false
Skip Tour : Shows when canSkip is true and not on last step
Default styles include:
White background with rounded corners
Creating a Custom Card
To create a custom card component, implement the CardProps interface:
Important Notes
ForwardRef : Cards should use forwardRef for proper positioning
Last Step Logic : Check both isLastStep and canGoNext for finish button
Conditional Rendering : Respect showControls and canSkip props
Styling Override : Custom style prop should merge with default styles
Props Summary Table
Prop
Type
Required
Default
Description
Current step index (0-based)
Navigate to previous step
React.CSSProperties | undefined
Default Styling Values
Last updated 5 months ago