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.
---
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.
---
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)
Horizontal connector (vertical layout)
---
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.
---
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.
---
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)
Horizontal connector (vertical layout)
---
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.
---
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.
---
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.
---
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.
---
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.
---
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.
---
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
---
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>---
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
---
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.
This text renders as a paragraph.
---
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
| Prop | Type | Default | Description |
|---|---|---|---|
| icon | IconConfig | — | Icon configuration (name, class, aria-label) rendered alongside the title/content. |
| image | ImageProps | — | 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. |
| title | string | — | Title text displayed for the item. Omitted or empty renders no title element. |
| content | RichText | — | Markdown (RichText) displayed below/beside the title; HTML passes through. Omitted or empty renders no content element. |
| actions | ButtonProps[] | [] | Action buttons rendered below/beside the content (default: []). |
| defaultActionConfig | LayerConfig<ButtonProps> | — | Button props merged under every action, overridden by each action's own values. |
| actionsClass | string | — | 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'). |
| orientation | ItemOrientation | 'vertical' | Orientation of the item: stacked/centered or icon-left/text-right (default: 'vertical'). |
| background | SimpleBackgroundProps | — | Background configuration for the item; only color backgrounds supported. |
| spacing | Omit<SpacingConfig, 'gap'> | — | Spacing configuration applied to the item. |
| border | BorderConfig | — | Border configuration applied to the item. |
| class | string | '' | Additional custom classes merged onto the item's root element (default: ''). |
| titleClass | string | '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'). |
| textClass | string | 'mb-2 md:mb-3' | Classes on the content text; replaces the default spacing (default: 'mb-2 md:mb-3'). |
| mediaClass | string | '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'). |
| contentClass | string | — | Additional custom classes applied to the content element. |
| showConnector | boolean | false | Shows a connector line on both sides of the item, for timeline UIs (default: false). |
| showConnectorLeft | boolean | false | Shows a connector line on the left/top side of the item (default: false). |
| showConnectorRight | boolean | false | Shows 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'). |
| connectorClass | string | '' | Additional custom classes applied to the connector line(s) (default: ''). |