🚀 Ship faster with premium components 🚀
Search documentation v1.1.0

How To

Present step-by-step guides with visuals

Source Report Issue
Command docs
How to add this block to your project
npm run add HowTo

Use the HowTo component to display a numbered step-by-step guide or tutorial with visuals, titles, and descriptions. They combine image and text for better comprehension and visual learning.

Preview
Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Unlock code
How to use the HowTo component in Astro
---
const steps = [
{
img: {
src: '/img/intro.webp',
alt: 'Selecting a block from the CLI',
width: 250,
height: 250
},
title: 'Choose a Block',
description: 'Use the CLI to copy available UI blocks...'
}
]
---
<HowTo steps={steps} />

The component expects a steps prop that describe each step. Each step can have the following three attributes:

Auto-width

The component will automatically fill up the available space of its container. This means that each step will be as wide as its container, only one step is visible at a time. If you want to disable this behavior and have each step have its width automatically calculated based on its content, you can set the fillContainer prop to false:

Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Unlock code
How to force auto-width
<HowTo
steps={steps}
fillContainer={false}
/>

Removing Step Numbers

By default, each step is numbered. You can remove numbers by setting the showStepNumber prop to false:

With step numbers (default)
Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Without step numbers
Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Unlock code
How to remove step numbers
<HowTo
steps={steps}
showStepNumber={false}
/>

Non-scrollable

If you want to display steps without a scroll (wrap steps under each other), you can set the scrollable prop to false:

Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Unlock code
How to remove scroll
<HowTo
steps={steps}
scrollable={false}
/>

Card Styles

You can also use the compact and secondary props similar to Card components to set the style of each step (secondary on the left, compact on the right):

Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Selecting a block from the CLI Choose a Block
Use the CLI to copy available UI blocks and add it to your project. You can do the same with templates.
Code editor with component inserted Insert into Your Code
The selected block will be copied into your src/components directory (or the one specified by your CLI command), ready to use.
Browser preview of Astro site with new block Preview Your Site
Run npm run dev and see your new UI block live in your Astro project.
Unlock code
How to specify card styles
<HowTo
steps={steps}
secondary={true}
/>
Unlock code
How to specify card styles
<HowTo
steps={steps}
compact={true}
/>

API

Unlock code
Component API reference
type HowToProps = {
showStepNumber?: boolean
scrollable?: boolean
fillContainer?: boolean
steps: {
img: {
src: string
alt: string
width: number
height: number
lazy?: boolean
}
title: string
description: string
}[]
className?: string
} & Pick<CardProps, 'compact' | 'secondary'>
PropDefaultPurpose
showStepNumber true Shows step numbers for each card.
scrollable true Displays the steps next to each other with a scroll.
fillContainer true Makes one step take up the full width of its container.
steps.img.src - Sets the path for the image.
steps.img.alt - Sets an alternate text for the image.
steps.img.width - Sets the width of the image.
steps.img.height - Sets the height of the image.
steps.img.lazy false Set to true to enable lazy loading for the image.
steps.title - Sets the title of the step.
steps.description - Sets the description of the step. Supports HTML.
className - Pass additional CSS classes for the component.