Marketing sectionsHeroSplit
Searchastronomic.dev# HeroSplit
At the top of a page, for the main heading, one line on what you offer and one or two actions, with an image beside them.
Static: no JavaScript.
## Usage
```astro
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
```
## Examples
### Studio home page
With no image, the text alone.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
const actions = [
{ label: "Start a project", href: "#start" },
{ label: "See our work", href: "#work" },
];
---
<div class="mx-auto max-w-6xl px-6 py-20">
<HeroSplit
heading="Brand and web design for firms that sell expertise."
text="We help consultancies and studios explain what they do, and win the clients they want."
actions={actions}
>
<Badge slot="eyebrow" status="positive">Taking new projects</Badge>
</HeroSplit>
</div>
```
### Lower on the page
With headingTag="h2", for a hero that does not open the page.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
const actions = [
{ label: "Start a project", href: "#start" },
{ label: "See our work", href: "#work" },
];
---
<div class="mx-auto max-w-6xl px-6 py-20">
<HeroSplit
heading="Brand and web design for firms that sell expertise."
text="We help consultancies and studios explain what they do, and win the clients they want."
actions={actions}
headingTag="h2"
>
<Badge slot="eyebrow" status="positive">Taking new projects</Badge>
</HeroSplit>
</div>
```
### With an image
Beside the text from a 48rem hero, under it below that. Side by side the heading takes text-display-split, so it does not shrink in the narrower column.
```astro
---
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
// Your own image file.
import shelves from "../../photos/studio-shelves.webp";
const actions = [
{ label: "See our work", href: "#work" },
{ label: "Book a call", href: "#call" },
];
---
<div class="mx-auto max-w-6xl px-6 py-20">
<HeroSplit
heading="Design that holds up after launch."
text="A small studio for brands that would rather be clear than loud."
actions={actions}
image={{ src: shelves, alt: "Stacks of plates and bowls on two white shelves." }}
/>
</div>
```
## Props
### HeroSplit
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `string` | None | Required. The main heading. |
| `emphasis` | `boolean` | `false` | Turn one *phrase* in the heading into <em>: exactly two asterisks around text with no space inside, as in "Built for *the long run*". Any other asterisks show as typed. Off by default, so the heading shows as typed. How the <em> looks is the theme's. |
| `text` | `string` | None | One or two sentences under the heading. |
| `actions` | `Omit<NavAction, "size">[]` | `[]` | Buttons, always in the large size. NavAction is { label, href, variant? }. The first is `primary` and the rest `secondary`, unless you set variant. |
| `headingTag` | `"h1" \| "h2" \| "h3" \| "h4"` | `"h1"` | The heading element. Keep `h1` when the hero opens the page. |
| `image` | `MediaImage` | None | An image beside the text from a 48rem hero, under it when narrower. MediaImage is { src, alt, width?, height?, ratio?, loading?, focalPoint? }; here the ratio defaults to 4/3 and loading to eager. |
| `side` | `"end" \| "start"` | `"end"` | The image's side on a wide hero. The text stays first in the reading order. |
| `class` | `string` | None | More classes, merged with cn(), so yours win on conflicts. |
| Slot | Description |
| --- | --- |
| `eyebrow` | A short line above the heading, such as a Badge. |
| `media` | Your own image element in place of image, for example an Astro <Image>. It wins over image. |
| `default` | More content under the actions, such as a LogoStrip. |
Any other attribute goes on the <section>.
## Accessibility
- Renders a <section> named by its heading, so it is a region landmark.
- The heading is an h1 by default. Use one h1 per page; set headingTag when the hero sits lower.
- Actions are links that look like buttons. Give each a label that says where it goes.
- The image comes after the text in the page order, also with side="start", so a screen reader reads the heading first. It needs alt like any Media.
- The <em> is read as part of the heading. Use plainHeading() (lib/emphasis.ts) for the page <title>.
HeroSplit
FreeAt the top of a page, for the main heading, one line on what you offer and one or two actions, with an image beside them.
- File
- HeroSplit.astro
- Group
- Marketing sections
- Kind
- Static: no JavaScript
- Examples
- 3
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Studio home page
With no image, the text alone.
This preview did not load.
main.astro
examples/herosplit/main.astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
const actions = [
{ label: "Start a project", href: "#start" },
{ label: "See our work", href: "#work" },
];
---
<div class="mx-auto max-w-6xl px-6 py-20">
<HeroSplit
heading="Brand and web design for firms that sell expertise."
text="We help consultancies and studios explain what they do, and win the clients they want."
actions={actions}
>
<Badge slot="eyebrow" status="positive">Taking new projects</Badge>
</HeroSplit>
</div>Lower on the page
With headingTag="h2", for a hero that does not open the page.
This preview did not load.
card.astro
examples/herosplit/card.astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
const actions = [
{ label: "Start a project", href: "#start" },
{ label: "See our work", href: "#work" },
];
---
<div class="mx-auto max-w-6xl px-6 py-20">
<HeroSplit
heading="Brand and web design for firms that sell expertise."
text="We help consultancies and studios explain what they do, and win the clients they want."
actions={actions}
headingTag="h2"
>
<Badge slot="eyebrow" status="positive">Taking new projects</Badge>
</HeroSplit>
</div>With an image
Beside the text from a 48rem hero, under it below that. Side by side the heading takes text-display-split, so it does not shrink in the narrower column.
This preview did not load.
image.astro
examples/herosplit/image.astro
---
import HeroSplit from "@astronomic-dev/ui/components/HeroSplit.astro";
// Your own image file.
import shelves from "../../photos/studio-shelves.webp";
const actions = [
{ label: "See our work", href: "#work" },
{ label: "Book a call", href: "#call" },
];
---
<div class="mx-auto max-w-6xl px-6 py-20">
<HeroSplit
heading="Design that holds up after launch."
text="A small studio for brands that would rather be clear than loud."
actions={actions}
image={{ src: shelves, alt: "Stacks of plates and bowls on two white shelves." }}
/>
</div>Minimal · Light