List with Icons
Improve list readability with icons
Use the IconList
component to combine text with icons, improving readability and making informational content visually more engaging. You can use them to highlight features or benefits of a product, create pros and cons list, or organize information like contact details or services.
-
Advantages: ...
-
Disadvantages: ...
The IconList
component expects an array of items in the form of:
icon
: Specify an icon using theicon
property. Pass the type of icon for Astro components, or import SVG strings to your component and pass them to theicon
prop. For a list of available icons in Webcore, see the documentation of theIcon
component.text
: Sets the text for the list item. Thetext
property supports HTML content.color
: Optionally, you can set the color of the icon using thecolor
property. You can use existing Webcore color variables.
Columns
By default, the IconList
component will create a simple ul
with icons using a single column. This can be modified by setting the columns
prop:
-
Highlight 1
-
Highlight 2
-
Highlight 3
-
Downside 1
-
Downside 2
-
Downside 3
The column
prop will not take effect for small screen devices, instead, the element will be displayed using a single column. If you don’t want this behavior, you can remove the media query from your icon-list.module.scss
file:
If you want to use X amount of columns by default, you can override the following CSS property, and omit the columns
prop from the component:
Icon Colors
In the above examples, icons colors were specified on an individual basis. However, you can set a single color for every list item by defining the color
prop on the component:
-
Highlight 1
-
Highlight 2
-
Highlight 3
Similar to the column count, you can set this color globally if you only need to use a single color for all components. Simply override the following CSS variable:
API
Prop | Purpose |
---|---|
columns | Sets the number of columns for the list. |
color | Sets the color of the icons. |
items.icon | Sets an icon for the list item. |
items.text | Sets the text for the list item. Supports HTML content. |
items.color | Sets the color of the icon for the list item. Overwrites the color prop. |
className | Pass additional CSS classes for your element. |
Request improvement for this page