Grid with Icons
Organize content into a grid layout with icons
Use the GridWithIcons
component to organize content into a grid layout, pairing each item with an icon to enhance clarity and visual appeal. They improve visual hierarchy, and can help structure information. Use them to showcase product features, services, or categories.
-
Grid with Icons Use the
GridWithIcons
block to organize your list into a grid with icons to enhance clarity and visual appeal. -
Configurable You can create as many items as necessary with icons and an optional title. You can also configure the number of columns.
-
Supports formatting The
text
prop also supports formatting through HTML tags to help you customize the appearance of the element.
The GridWithIcons
component expects an items
prop that defines the grid items as an array of objects in the following format:
icon
: Sets an optional icon for the grid item. It can be an icon type for the Astro component, or an SVG string for Svelte/React components. For available icon types, visit the documentation of theIcon
component.title
: Sets an optional title for the grid item.text
: Sets the text of the grid item. The text supports HTML tags.
Columns
By default, the GridWithIcons
component will use a three column layout. This can be changed by specifying the number of columns using the columns
prop:
-
Grid with Icons Use the
GridWithIcons
block to organize your list into a grid with icons to enhance clarity and visual appeal. -
Configurable You can create as many items as necessary with icons and an optional title. You can also configure the number of columns.
-
Supports formatting The
text
prop also supports formatting through HTML tags to help you customize the appearance of the element. - Graceful degradation If the
items
prop is not defined, nothing will be rendered. Grid items can be rendered without icons or titles too.
Column can go up to a maximum of 4. If you need to have more columns, you can add the following css rules to your grid-with-icons.module.scss
file:
You’ll also need to update your type definitions in gridWithIcons.ts
to avoid type errors:
Alignments
The component also supports center and right alignments. To change the alignment, set the alignment
prop to center
or right
:
-
Grid with Icons Use the
GridWithIcons
block to organize your list into a grid with icons to enhance clarity and visual appeal.
-
Grid with Icons Use the
GridWithIcons
block to organize your list into a grid with icons to enhance clarity and visual appeal.
Types
You can further customize the appearance of your GridWithIcons
component using two additional props:
iconWithBackground
: Sets a solid background for the icons.secondary
: Displays icons next to the grid item titles.
-
Grid with Icons Use the
GridWithIcons
block to organize your list into a grid with icons to enhance clarity and visual appeal.
- Grid with IconsUse the
GridWithIcons
block to organize your list into a grid with icons to enhance clarity and visual appeal.
API
Prop | Purpose |
---|---|
items | Sets the items for the grid. |
items.icon | Sets an optional icon for the grid item. |
items.title | Sets an optional title for the grid item. |
items.text | Sets the text for the grid item. Supports HTML tags. |
columns | Sets the number of columns for the grid. |
alignment | Sets the alignment of the grid items. |
iconWithBackground | Adds a solid background to the icons. |
secondary | Displays icons next to titles. |
className | Pass additional CSS classes for your component. |
Request improvement for this page