Composite

Item

Single icon/title/content/actions block — the building block behind ItemsGrid, ItemsTimeline, and ItemsTimelineHorizontal.

Item renders an optional icon or image, an optional title, optional content, and action buttons, in either a vertical (stacked, centered) or horizontal (icon-left, text-right) layout. It renders only what it is given. It also supports optional connector lines, used to build timeline UIs.

Basic Vertical Item

Default layout: icon, title, and content stacked and centered.

Vertical Layout
Icon, title, and content are stacked and centered. This is the default layout.
basic-vertical
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-sm">
  <Item
    icon={{ name: 'heroicons:sparkles', class: 'text-accent' }}
    title="Vertical Layout"
    content="Icon, title, and content are stacked and centered. This is the default layout."
    actions={[{ label: 'Learn More', intent: 'accent', size: 'sm' }]}
  />
</div>

Horizontal Layout

Icon on the left, title and content left-aligned on the right.

Horizontal Layout
The icon sits to the left, with the title and content left-aligned beside it.
horizontal
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-md">
  <Item
    icon={{ name: 'heroicons:bolt', class: 'text-success' }}
    title="Horizontal Layout"
    content="The icon sits to the left, with the title and content left-aligned beside it."
    actions={[{ label: 'Learn More', intent: 'success', size: 'sm' }]}
    orientation="horizontal"
  />
</div>

Connector Lines

Connector lines link items together to build timeline UIs. Use showConnector on a horizontal item for a vertical connecting line (as used by ItemsTimeline), or showConnectorLeft/showConnectorRight on a vertical item for a horizontal connecting line (as used by ItemsTimelineHorizontal).

Vertical connector (horizontal layout)

Step 1: Download
Get started by downloading the template.
Step 2: Customize
Add your own content and styles.
Step 3: Done
Ship it!

Horizontal connector (vertical layout)

Sign Up
Create your account.
Verify
Confirm your email.
Launch
You're all set.
connectors
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="space-y-8">
  <div>
    <p class="text-sm font-semibold">Vertical connector (horizontal layout)</p>
    <div class="max-w-md">
      <Item
        icon={{ name: 'heroicons:arrow-down-tray', class: 'text-primary' }}
        title="Step 1: Download"
        content="Get started by downloading the template."
        orientation="horizontal"
        showConnector
      />
      <Item
        icon={{ name: 'heroicons:pencil-square', class: 'text-secondary' }}
        title="Step 2: Customize"
        content="Add your own content and styles."
        orientation="horizontal"
        showConnector
      />
      <Item
        icon={{ name: 'heroicons:check-circle', class: 'text-success' }}
        title="Step 3: Done"
        content="Ship it!"
        orientation="horizontal"
      />
    </div>
  </div>
  <div>
    <p class="text-sm font-semibold">Horizontal connector (vertical layout)</p>
    <div class="flex flex-row items-start">
      <Item
        icon={{ name: 'heroicons:user-plus', class: 'text-primary' }}
        title="Sign Up"
        content="Create your account."
      />
      <Item
        icon={{ name: 'heroicons:envelope', class: 'text-secondary' }}
        title="Verify"
        content="Confirm your email."
        showConnectorLeft
        showConnectorRight
      />
      <Item
        icon={{ name: 'heroicons:rocket-launch', class: 'text-success' }}
        title="Launch"
        content="You're all set."
        showConnectorLeft
      />
    </div>
  </div>
</div>

Optional Text

title and content are both optional. Item renders only what it is given — an omitted or empty value produces no element and no reserved space.

Title Only
Content without a title.
optional-text
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="flex flex-wrap items-start gap-6">
  <div class="max-w-xs">
    <Item icon={{ name: 'heroicons:swatch', class: 'text-primary' }} title="Title Only" />
  </div>
  <div class="max-w-xs">
    <Item
      icon={{ name: 'heroicons:eye', class: 'text-secondary' }}
      content="Content without a title."
    />
  </div>
  <div class="max-w-xs">
    <Item icon={{ name: 'heroicons:sparkles', class: 'text-accent' }} />
  </div>
</div>

Image Instead of Icon

image carries the Image primitive’s configuration and renders in the same media slot as icon. The two are mutually exclusive — when both are supplied the image wins. image.alt is required at runtime; the Image primitive throws without it. Supply width/height or an aspectRatio, or the optimizer logs an error. The default box is size-8 md:size-10 lg:size-12, which fixes both axes — pass image.class to override it or to add object-* handling for a non-square source.

Mountain landscape
Image, Title and Content
The image replaces the icon in the media slot.
Mountain landscape
Mountain landscape
Horizontal
An image works in the horizontal layout too.
image
---
import Item from '@alfadormx/blocks/composite/Item.astro';
import type { ImageProps } from '@alfadormx/blocks/types/image';

const image: ImageProps = {
  src: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4',
  alt: 'Mountain landscape',
  width: 96,
  height: 96,
};
---

<div class="flex flex-wrap items-start gap-6">
  <div class="max-w-xs">
    <Item
      image={image}
      title="Image, Title and Content"
      content="The image replaces the icon in the media slot."
    />
  </div>
  <div class="max-w-xs">
    <Item image={image} />
  </div>
  <div class="max-w-md">
    <Item
      image={image}
      title="Horizontal"
      content="An image works in the horizontal layout too."
      orientation="horizontal"
    />
  </div>
</div>

Image With Connectors

Images work under every connector variant, so ItemsTimeline and ItemsTimelineHorizontal can render image-led steps.

Vertical connector (horizontal layout)

Mountain landscape
Step 1
An image under showConnector.
Mountain landscape
Step 2
The last step has no connector.

Horizontal connector (vertical layout)

Mountain landscape
First
Mountain landscape
Middle
Mountain landscape
Last
image-connectors
---
import Item from '@alfadormx/blocks/composite/Item.astro';
import type { ImageProps } from '@alfadormx/blocks/types/image';

const image: ImageProps = {
  src: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4',
  alt: 'Mountain landscape',
  width: 96,
  height: 96,
};
---

<div class="space-y-8">
  <div>
    <p class="text-sm font-semibold">Vertical connector (horizontal layout)</p>
    <div class="max-w-md">
      <Item
        image={image}
        title="Step 1"
        content="An image under showConnector."
        orientation="horizontal"
        showConnector
      />
      <Item
        image={image}
        title="Step 2"
        content="The last step has no connector."
        orientation="horizontal"
      />
    </div>
  </div>
  <div>
    <p class="text-sm font-semibold">Horizontal connector (vertical layout)</p>
    <div class="flex flex-row items-start">
      <Item image={image} title="First" />
      <Item image={image} title="Middle" showConnectorLeft showConnectorRight />
      <Item image={image} title="Last" showConnectorLeft />
    </div>
  </div>
</div>

Custom Typography and Media Size

titleClass, textClass and mediaClass replace the default title typography, content spacing and icon or image sizes. They do not merge with the defaults, so set every class you need. icon.class and image.class still merge on top of mediaClass.

Small caps title
A compact item with a small icon.
custom-typography
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-sm">
  <Item
    icon={{ name: 'heroicons:sparkles', class: 'text-accent' }}
    title="Small caps title"
    content="A compact item with a small icon."
    titleClass="text-sm uppercase tracking-wider"
    textClass="text-xs text-muted"
    mediaClass="size-6"
  />
</div>

Connector Class

connectorClass styles every visible connector line in either layout. Hidden sides stay transparent.

Sign Up
Verify
Launch
Download
connector-class
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="space-y-8">
  <div class="flex flex-row items-start">
    <Item
      icon={{ name: 'heroicons:user-plus', class: 'text-primary' }}
      title="Sign Up"
      showConnectorRight
      connectorClass="border-primary"
    />
    <Item
      icon={{ name: 'heroicons:envelope', class: 'text-secondary' }}
      title="Verify"
      showConnectorLeft
      showConnectorRight
      connectorClass="border-primary"
    />
    <Item
      icon={{ name: 'heroicons:rocket-launch', class: 'text-success' }}
      title="Launch"
      showConnectorLeft
      connectorClass="border-primary"
    />
  </div>
  <div class="max-w-md">
    <Item
      icon={{ name: 'heroicons:arrow-down-tray', class: 'text-primary' }}
      title="Download"
      showConnector
      connectorClass="border-primary"
    />
  </div>
</div>

Spacing margin

spacing.margin lands on the item root next to spacing.padding.

Spaced
Pushed down by its own margin.
spacing-margin
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<Item
  title="Spaced"
  content="Pushed down by its own margin."
  spacing={{ padding: 'p-4', margin: 'mt-8' }}
  border={{ width: 'border', color: 'border-border' }}
/>

Action Defaults

defaultActionConfig is one layer merged under every action, so one setting styles them all; an action’s own values win. Prefer it over defaultItemConfig.actions in a grid, which merges by index and so reaches only the first action.

Open source
Read the code, try the demo, or tell us what broke.
default-action-config
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-sm">
  <Item
    icon={{ name: 'heroicons:code-bracket', class: 'text-primary' }}
    title="Open source"
    content="Read the code, try the demo, or tell us what broke."
    defaultActionConfig={{ variant: 'outline', intent: 'accent', size: 'sm' }}
    actions={[
      { label: 'Docs', href: '#' },
      { label: 'Demo', href: '#' },
      { label: 'Report', href: '#', intent: 'error' },
    ]}
  />
</div>

Actions Class

actionsClass merges over the actions wrapper’s default flex flex-wrap gap-2 md:gap-3 mt-2 md:mt-3. Here the actions stack.

Get started
Pick a plan to continue.
actions-class
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-sm">
  <Item
    icon={{ name: 'heroicons:rocket-launch', class: 'text-primary' }}
    title="Get started"
    content="Pick a plan to continue."
    actionsClass="flex-col items-stretch"
    actions={[
      { label: 'Start free', href: '#' },
      { label: 'Talk to sales', href: '#', variant: 'outline' },
    ]}
  />
</div>

Title Tag

titleTag sets the title’s semantics only. A heading tag renders the title through Headline with the same look as the default div, so each pair below looks identical. Heading titles are not allowed in selectable grids, where an option cannot hold a heading.

Our team
The people behind the product.
title-tag-div
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-xs">
  <Item
    icon={{ name: 'heroicons:user-group', class: 'text-primary' }}
    title="Our team"
    content="The people behind the product."
  />
</div>

Our team

The people behind the product.
title-tag-h3
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-xs">
  <Item
    icon={{ name: 'heroicons:user-group', class: 'text-primary' }}
    title="Our team"
    titleTag="h3"
    content="The people behind the product."
  />
</div>
Our team
The people behind the product.
title-tag-div-horizontal
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-xs">
  <Item
    icon={{ name: 'heroicons:user-group', class: 'text-primary' }}
    title="Our team"
    content="The people behind the product."
    orientation="horizontal"
  />
</div>

Our team

The people behind the product.
title-tag-h3-horizontal
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-xs">
  <Item
    icon={{ name: 'heroicons:user-group', class: 'text-primary' }}
    title="Our team"
    titleTag="h3"
    content="The people behind the product."
    orientation="horizontal"
  />
</div>

Text Tag

textTag sets the tag of the element styled by textClass. Use 'p' only for plain or inline content: a <p> cannot hold block HTML such as <p> or <ul>, and the browser would break it apart.

Paragraph

This text renders as a paragraph.

text-tag
---
import Item from '@alfadormx/blocks/composite/Item.astro';
---

<div class="max-w-sm">
  <Item
    icon={{ name: 'heroicons:document-text', class: 'text-primary' }}
    title="Paragraph"
    content="This text renders as a paragraph."
    textTag="p"
  />
</div>

API Reference

PropTypeDefaultDescription
iconIconConfig—Icon configuration (name, class, aria-label) rendered alongside the title/content.
imageImageProps—Image configuration rendered through the Image primitive, in the same media slot as `icon`. Mutually exclusive with `icon` — when both are set the image wins. `alt` is required at runtime; the Image primitive throws without it.
titlestring—Title text displayed for the item. Omitted or empty renders no title element.
contentRichText—Markdown (RichText) displayed below/beside the title; HTML passes through. Omitted or empty renders no content element.
actionsButtonProps[][]Action buttons rendered below/beside the content (default: []).
defaultActionConfigLayerConfig<ButtonProps>—Button props merged under every action, overridden by each action's own values.
actionsClassstring—Classes on the actions wrapper, merged over the default 'flex flex-wrap gap-2 md:gap-3 mt-2 md:mt-3'.
titleTag'div' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6''div'Tag of the title. A heading tag renders through Headline with the same look as 'div'; sets semantics only (default: 'div').
textTag'div' | 'p''div'Tag of the element styled by `textClass`. 'p' is invalid when `content` holds block HTML such as <p> or <ul> (default: 'div').
orientationItemOrientation'vertical'Orientation of the item: stacked/centered or icon-left/text-right (default: 'vertical').
backgroundSimpleBackgroundProps—Background configuration for the item; only color backgrounds supported.
spacingOmit<SpacingConfig, 'gap'>—Spacing configuration applied to the item.
borderBorderConfig—Border configuration applied to the item.
classstring''Additional custom classes merged onto the item's root element (default: '').
titleClassstring'font-bold text-lg md:text-xl lg:text-2xl mb-1 md:mb-2'Classes on the title; replaces the default typography (default: 'font-bold text-lg md:text-xl lg:text-2xl mb-1 md:mb-2').
textClassstring'mb-2 md:mb-3'Classes on the content text; replaces the default spacing (default: 'mb-2 md:mb-3').
mediaClassstring'size-8 md:size-10 lg:size-12'Size classes for the icon or image; replaces the default sizes, while `icon.class`/`image.class` still merge on top (default: 'size-8 md:size-10 lg:size-12').
contentClassstring—Additional custom classes applied to the content element.
showConnectorbooleanfalseShows a connector line on both sides of the item, for timeline UIs (default: false).
showConnectorLeftbooleanfalseShows a connector line on the left/top side of the item (default: false).
showConnectorRightbooleanfalseShows a connector line on the right/bottom side of the item (default: false).
connectorStyle'solid' | 'dashed' | 'dotted''solid'Visual style of the connector line (default: 'solid').
connectorClassstring''Additional custom classes applied to the connector line(s) (default: '').