Skip to main content

Image card

A default content card with a heading and optional description, image and buttons. It can be centered with a prop and is intended for use in columns or with a carousel wrapper.

How to use

<Section class="mt-4 md:mt-12" columns={3}>
<Markdown class="md:col-span-3">

# Default card

A default content card with a heading and optional description. It can be centered with a prop and is intended for use in columns or with a carousel wrapper.

</Markdown>

import ImageCard from "~/components/cards/Image.astro";

<ImageCard image={{ src: Image2, alt: "" }} />
<ImageCard image={{ src: Image3, alt: "" }} />
<ImageCard image={{ src: Image4, alt: "" }} />

</Section>

Props

PropTypeDescription
imageobject(optional) Image data for the component. See below.
layoutobject(optional) Layout data for the component. See below.
classstring(optional) Additional classes applied to the root <figure>.
(extends)HTMLAttributes<"figure">(optional) All standard HTML attributes for a <figure>.

image object

  • srcImageMetadata
    The imported image metadata (output from Astro’s image import).
  • alt — string
    (optional) Alt text for the image, defaults to empty string "".

layout object

  • aspect — “auto” | “landscape” | “portrait” | “square” | “video”. (optional) Sets the aspect ratio of the image.
  • objectFit — “cover” | “contain”
    (optional) Set the object-fit CSS property for the image. Default is cover.

More examples

2 Columns

3 Columns

4 Columns

5 Column Marquee


About MDX

astro-skeleton uses the @astrojs/mdx integration installed and configured in the astro.config.mjs config file.

Why MDX?

MDX is a special flavor of Markdown that supports embedded JavaScript & JSX syntax. This unlocks the ability to mix JavaScript and UI Components into Markdown content for things like interactive charts or alerts.

If you have existing content authored in MDX, this integration will hopefully make migrating a breeze.

Documentation