Overview
Steps component provides a wizard-like navigation showing progress through a multi-step process.
Import
import { MagarySteps, StepsItem } from 'ng-magary';
Basic Usage
<magary-steps
[model]="steps"
[activeIndex]="activeStep"
(activeIndexChange)="onStepChange($event)">
</magary-steps>
Interactive Steps
<magary-steps
[model]="steps"
[activeIndex]="currentStep"
[readonly]="false"
(activeIndexChange)="navigateToStep($event)">
</magary-steps>
Vertical Orientation
<magary-steps
[model]="steps"
[activeIndex]="activeStep"
[orientation]="'vertical'">
</magary-steps>
With Router Integration
steps: StepsItem[] = [
{
label: 'Account',
routerLink: '/setup/account',
icon: 'user'
},
{
label: 'Profile',
routerLink: '/setup/profile',
icon: 'id-card'
},
{
label: 'Complete',
routerLink: '/setup/complete',
icon: 'check'
}
];
With Command Handlers
steps: StepsItem[] = [
{
label: 'Step 1',
command: (event) => {
console.log('Step 1 clicked', event);
this.validateStep1();
}
},
{
label: 'Step 2',
command: (event) => {
this.validateStep2();
}
}
];
Whether steps are clickable
Inline styles for the component
CSS class for the component
orientation
'horizontal' | 'vertical'
default:"'horizontal'"
Layout orientation
Output Events
Emitted when active step changes
StepsItem Interface
interface StepsItem {
label: string;
icon?: string;
command?: (event?: any) => void;
url?: string;
routerLink?: string | any[];
queryParams?: Record<string, unknown>;
disabled?: boolean;
target?: string;
routerLinkActiveOptions?: IsActiveMatchOptions;
style?: Record<string, any>;
styleClass?: string;
}
Complete Example with Content
<magary-steps
[model]="steps"
[activeIndex]="activeIndex"
[readonly]="false"
(activeIndexChange)="activeIndex = $event">
</magary-steps>
<div class="step-content">
<div *ngIf="activeIndex === 0">
<h3>Personal Information</h3>
<p>Enter your personal details...</p>
</div>
<div *ngIf="activeIndex === 1">
<h3>Address</h3>
<p>Enter your address...</p>
</div>
<div *ngIf="activeIndex === 2">
<h3>Confirmation</h3>
<p>Review your information...</p>
</div>
</div>
<div class="step-actions">
<button
(click)="prevStep()"
[disabled]="activeIndex === 0">
Previous
</button>
<button
(click)="nextStep()"
[disabled]="activeIndex === steps.length - 1">
Next
</button>
</div>
Features
- Horizontal/Vertical: Support for both orientations
- Interactive: Optional clickable steps
- Router integration: Works with Angular Router
- Icons: Support for step icons
- Command handlers: Execute code on step click
- Disabled steps: Prevent navigation to certain steps
- Custom styling: Full styling control
Accessibility
- Semantic HTML
- ARIA attributes
- Keyboard navigation
- Screen reader support
- Focus management