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

Card with List

Display list of key points within a card

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

Use the CardWithList component to present structured information inside a visually contained card layout, combining an optional image, title, subtext, badge, and an ordered or unordered list of key points. You can use them for feature breakdowns (e.g., “What’s included”), step summaries or process overviews, benefit lists on landing pages, and service or product comparisons.

Astro islands architecture illustration
Build Sites with Astro Beginner
Learn the fundamentals of Astro
  • Island architecture explained
  • Zero-JS by default
  • File-based routing
  • Component framework agnostic
Unlock code
How to use the CardWithList component in Astro
<CardWithList
img={{
src: '/img/placeholder7.png',
alt: 'Astro islands architecture illustration',
width: 50,
height: 50
}}
title="Build Sites with Astro"
subText="Learn the fundamentals of Astro"
list={[
'Island architecture explained',
'Zero-JS by default',
'File-based routing',
'Component framework agnostic'
]}
badge={{ text: 'Beginner' }}
/>

The component can be configured in many different ways to get visually distinct elements. However, the only required props are title and list:

Card with required props only
  • Island architecture explained
  • Zero-JS by default
  • File-based routing
  • Component framework agnostic
Unlock code
How to create a minimal card
<CardWithList
title="Card with required props only"
list={[
'Island architecture explained',
'Zero-JS by default',
'File-based routing',
'Component framework agnostic'
]}
/>

The img, subText, and badge props are optional, as well as the other props discussed below. In case your card is situated below the fold, you can set img.lazy to true to enable lazy loading for the image.

Badges

The component supports a badge that can be displayed on the top right corner of the card. You can set the badge.text prop to display the badge. Optionally, you can also set the badge.icon prop to display an icon for the badge:

Astro islands architecture illustration
Card with badge Code on GitHub
  • Island architecture explained
  • Zero-JS by default
  • File-based routing
  • Component framework agnostic
Unlock code
How to add a badge to your card
<CardWithList
...
badge={{
text: 'Code on GitHub',
icon: 'github' // Can be an SVG string or an icon type defined in the Icon component
}}
/>

List Types

By default, the component uses an unordered list (ul). You can switch to an ordered list (ol) by setting the type prop to ol:

Astro islands architecture illustration
Unordered List Beginner
Learn the fundamentals of Astro
  • Island architecture explained
  • Zero-JS by default
  • File-based routing
  • Component framework agnostic
Astro islands architecture illustration
Ordered List Beginner
Learn the fundamentals of Astro
  1. Island architecture explained
  2. Zero-JS by default
  3. File-based routing
  4. Component framework agnostic
Unlock code
How to change the list type
<CardWithList
...
type="ol"
/>

Themes

The component also comes with a theme prop that allows you to set the color of bullet points to one of the following: info, success, warning, and alert.

Astro islands architecture illustration
Info theme Beginner
Learn the fundamentals of Astro
  • Island architecture explained
  • Zero-JS by default
  • File-based routing
  • Component framework agnostic
Astro islands architecture illustration
Success theme Beginner
Learn the fundamentals of Astro
  1. Island architecture explained
  2. Zero-JS by default
  3. File-based routing
  4. Component framework agnostic
Astro islands architecture illustration
Warning theme Beginner
Learn the fundamentals of Astro
  • Island architecture explained
  • Zero-JS by default
  • File-based routing
  • Component framework agnostic
Astro islands architecture illustration
Alert theme Beginner
Learn the fundamentals of Astro
  1. Island architecture explained
  2. Zero-JS by default
  3. File-based routing
  4. Component framework agnostic
Unlock code
How to set the theme of bullet points
<CardWithList
...
theme="info" {/* or 'success' | 'warning' | 'alert' */}
badge={{ text: 'Beginner', theme: 'info' }}
/>
Note
You can also set the themes of badges using badge.theme. See the Badge component for all available themes.

API

Unlock code
Component API reference
type CardWithListProps = {
img?: {
src: string
alt: string
width: number
height: number
lazy?: boolean
}
title: string
subText?: string
list: string[]
type?: 'ol' | 'ul'
theme?: BadgeProps['theme']
badge?: {
text?: string
icon?: string
} & BadgeProps
} & CardProps
PropPurpose
img.src Sets the path for the image.
img.alt Sets an alternate text for the image.
img.width Sets the width of the image.
img.height Sets the height of the image.
img.lazy Set to true to enable lazy loading for the image.
title Sets the title of the card.
subText Sets an optional subtitle for the card.
list Sets the list of items.
type Sets the list type. Defaults to ul.
theme Sets the color of the bullet points.
badge.text Sets the text for the badge.
badge.icon Sets an icon for the badge. You can pass SVG strings, or an icon type for Astro components.
className Pass additional CSS classes for the component.