Hero
A top-of-page band that composes an eyebrow, heading, text, actions, and media into a hero.
Live demo
Hero is the top-of-page shape, assembled from the primitives you already have. Drop an Eyebrow, a Heading, a Text, a Cluster of Buttons, and maybe an Image inside it, and they stack into a centered hero with a comfortable measure and generous spacing.
It adds no behavior and no chrome of its own, so it inherits the page's surface and pairs cleanly over a Parallax band; the layout is pure CSS, so the hero renders the same with or without JavaScript. align switches the stack from centered to left-aligned, and split turns it into a two-column content-and-media band that folds back to one column on a narrow screen.
When to use
How this component composes with the rest of the set.
Props
2 props, straight from the manifest.
| Prop | Type | Default | Bindings | Description |
|---|---|---|---|---|
Anatomy
The named parts that make up the component, with their selectors.
hero
The band: a centered stack of the composed primitives with generous padding.
Tokens & coverage
What the component consumes, checked live against what the algorithm produces.
Live coverage check against the xtyle-default register
(derive(xtyleDefault, { anchors }) →
coverComponent(manifest, register)). Every token this component
consumes must be a key the algorithm produces.
--space-5
--space-6
--space-8
Slots
The hero content, composed from primitives: an Eyebrow, a Heading, a Text, a Cluster of Buttons, and optionally an Image. In split mode, a content block and a media block.
Accessibility
Code
Centered hero
An eyebrow, heading, supporting text, and a pair of actions, stacked and centered.
<xtyle-hero>
<xtyle-eyebrow>Now in beta</xtyle-eyebrow>
<xtyle-heading level="1">Theme anything, instantly</xtyle-heading>
<xtyle-text size="lg">A derivation engine that turns a few colors into a whole design.</xtyle-text>
<xtyle-cluster gap="3">
<xtyle-button variant="solid">Get started</xtyle-button>
<xtyle-button variant="subtle">Read the docs</xtyle-button>
</xtyle-cluster>
</xtyle-hero>
<script lang="ts">
import { Hero, Eyebrow, Heading, Text, Cluster, Button } from "@xtyle/svelte";
</script>
<Hero>
<Eyebrow>Now in beta</Eyebrow>
<Heading level={1}>Theme anything, instantly</Heading>
<Text size="lg">A derivation engine that turns a few colors into a whole design.</Text>
<Cluster gap={3}>
<Button variant="solid">Get started</Button>
<Button variant="subtle">Read the docs</Button>
</Cluster>
</Hero>
---
import Hero from "@xtyle/astro/Hero.astro";
import Eyebrow from "@xtyle/astro/Eyebrow.astro";
import Heading from "@xtyle/astro/Heading.astro";
import Text from "@xtyle/astro/Text.astro";
import Cluster from "@xtyle/astro/Cluster.astro";
import Button from "@xtyle/astro/Button.astro";
---
<Hero>
<Eyebrow>Now in beta</Eyebrow>
<Heading level={1}>Theme anything, instantly</Heading>
<Text size="lg">A derivation engine that turns a few colors into a whole design.</Text>
<Cluster gap={3}>
<Button variant="solid">Get started</Button>
<Button variant="subtle">Read the docs</Button>
</Cluster>
</Hero>
Split hero
A left-aligned content block beside a media block.
<xtyle-hero split align="start">
<div>
<xtyle-heading level="1">Ship a themed app today</xtyle-heading>
<xtyle-text>Compose the hero from the primitives you already have.</xtyle-text>
</div>
<xtyle-image src="/screenshot.png" alt="The app in action" ratio="4/3" />
</xtyle-hero>
<script lang="ts">
import { Hero, Heading, Text, Image } from "@xtyle/svelte";
</script>
<Hero split align="start">
<div>
<Heading level={1}>Ship a themed app today</Heading>
<Text>Compose the hero from the primitives you already have.</Text>
</div>
<Image src="/screenshot.png" alt="The app in action" ratio="4/3" />
</Hero>
---
import Hero from "@xtyle/astro/Hero.astro";
import Heading from "@xtyle/astro/Heading.astro";
import Text from "@xtyle/astro/Text.astro";
import Image from "@xtyle/astro/Image.astro";
---
<Hero split align="start">
<div>
<Heading level={1}>Ship a themed app today</Heading>
<Text>Compose the hero from the primitives you already have.</Text>
</div>
<Image src="/screenshot.png" alt="The app in action" ratio="4/3" />
</Hero>