PrerequisiteChain Demo
This page demonstrates the PrerequisiteChain component, which displays visual dependency chains between topics.
Basic Usage
Section titled “Basic Usage”The js-async tag has prerequisites defined (js-functions):
Prerequisites
Complete these topics before starting this content
import { PrerequisiteChain } from 'starlight-tags/components';
<PrerequisiteChain tagId="js-async" />Full Learning Path
Section titled “Full Learning Path”The js-objects tag shows a longer chain through arrays, functions, variables, and basics:
Prerequisites
Complete these topics before starting this content
Without Description
Section titled “Without Description”Hide the helper text for a more compact display:
Prerequisites
<PrerequisiteChain tagId="js-async" showDescription={false} />Limiting Chain Length
Section titled “Limiting Chain Length”For tags with many prerequisites, you can limit the display:
Prerequisites
Complete these topics before starting this content
<PrerequisiteChain tagId="js-objects" maxChainLength={3} />How Prerequisites Work
Section titled “How Prerequisites Work”Prerequisites are defined in your tags.yml configuration:
tags: js-basics: label: "JS Basics" description: "Introduction to JavaScript fundamentals"
js-variables: label: "Variables" prerequisites: - js-basics # Must understand basics first
js-functions: label: "Functions" prerequisites: - js-variables # Must understand variables firstThe component automatically:
- Reads the
prerequisiteChaincomputed property from the tag - Resolves the full chain recursively (prerequisites of prerequisites)
- Displays tags in order with arrows between them
- Highlights the current tag with “You are here”
Use Cases
Section titled “Use Cases”Audience Progression
Section titled “Audience Progression”Show users how content builds from beginner to advanced:
Prerequisites
Complete these topics before starting this content
- Getting Started
- You are hereAdvanced
Learning Paths
Section titled “Learning Paths”Guide users through a sequence of topics they should understand:
Prerequisites
Complete these topics before starting this content
Responsive Behavior
Section titled “Responsive Behavior”On mobile devices (< 768px):
- The chain displays vertically instead of horizontally
- Arrows rotate 90 degrees to point downward
- Resize your browser to see this in action
See the PrerequisiteChain documentation for full API reference.