Caret-Tui

StepWizard

A wizard component for multi-step processes.

StepWizard simplifies complex, multi-step CLI operations (like project initialization or installation flows). It provides a breadcrumb progress tracker and handles keyboard navigation between steps using Left/Right arrows or N/P keys.

Usage

import { StepWizard, Text } from 'caret-tui';

const steps = [
  { title: 'Configuration', content: <Text>Select your preferences...</Text> },
  { title: 'Dependencies', content: <Text>Installing packages...</Text> },
  { title: 'Complete', content: <Text>Ready to go!</Text> }
];

const App = () => (
  <StepWizard 
    steps={steps} 
    onComplete={() => console.log('Wizard Finished')} 
  />
);

Props

PropTypeDefaultDescription
stepsStep[]-The array of step definitions.
onComplete() => void-Callback fired when the user proceeds past the final step.
isActivebooleantrueIf false, disables keyboard navigation.

Step Definition

FieldTypeDescription
titlestringThe title displayed in the top progress tracker.
contentReact.ReactNodeThe interface to render when this step is active.

On this page