hero-section
The top of a landing page: a short eyebrow line, the headline, a sentence under it, the main actions, and a picture or demo beside (or under) it. Side by side when there's room, stacked when there isn't (by its own width). align is start or center.
This one has no events: it shows what it's given.
Source: hero-section.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/hero-section.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/hero-section.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/hero-section.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/hero-section.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/hero-section.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/hero-section.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/hero-section.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/hero-section.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/hero-section.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/hero-section.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/hero-section.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/hero-section.json
<link rel="stylesheet" href="https://zubra-js.github.io/zubra-ui/themes/default.css">
<script type="module" src="https://zubra-js.github.io/zubra-ui/cdn/hero-section.js"></script>The compiled install writes src/components/zubra/hero-section.js and the theme, and adds @zubra/runtime to your dependencies. The one-file install writes the same path as a plain custom element that needs nothing installed (or download it and load it with a <script type="module">); it's smaller on a page with one to three components, the shared runtime with more.
Usage
<hero-section
eyebrow="New: spring classes"
heading="Bake bread you are proud of"
align="start"
>
Small classes, real ovens, and a starter to take home. Weekends in Portland and online.
<action-button slot="actions" size="lg" href="#book">Book a class</action-button>
<action-button slot="actions" size="lg" variant="ghost" href="#schedule">See the schedule</action-button>
</hero-section>
<script type="module">
import './components/zubra/hero-section.js';
import './components/zubra/action-button.js';
</script>import './components/zubra/hero-section.js';
import './components/zubra/action-button.js';
export function HeroSectionExample() {
return (
<hero-section
eyebrow="New: spring classes"
heading="Bake bread you are proud of"
align="start"
>
Small classes, real ovens, and a starter to take home. Weekends in Portland and online.
<action-button slot="actions" size="lg" href="#book">Book a class</action-button>
<action-button slot="actions" size="lg" variant="ghost" href="#schedule">See the schedule</action-button>
</hero-section>
);
}<script setup>
import './components/zubra/hero-section.js';
import './components/zubra/action-button.js';
</script>
<template>
<hero-section
eyebrow="New: spring classes"
heading="Bake bread you are proud of"
align="start"
>
Small classes, real ovens, and a starter to take home. Weekends in Portland and online.
<action-button slot="actions" size="lg" href="#book">Book a class</action-button>
<action-button slot="actions" size="lg" variant="ghost" href="#schedule">See the schedule</action-button>
</hero-section>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/hero-section.js';
import './components/zubra/action-button.js';
</script>
<hero-section
eyebrow="New: spring classes"
heading="Bake bread you are proud of"
align="start"
>
Small classes, real ovens, and a starter to take home. Weekends in Portland and online.
<action-button slot="actions" size="lg" href="#book">Book a class</action-button>
<action-button slot="actions" size="lg" variant="ghost" href="#schedule">See the schedule</action-button>
</hero-section>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/hero-section.js';
import './components/zubra/action-button.js';
@Component({
selector: 'app-hero-section-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<hero-section
eyebrow="New: spring classes"
heading="Bake bread you are proud of"
align="start"
>
Small classes, real ovens, and a starter to take home. Weekends in Portland and online.
<action-button slot="actions" size="lg" href="#book">Book a class</action-button>
<action-button slot="actions" size="lg" variant="ghost" href="#schedule">See the schedule</action-button>
</hero-section>
`,
})
export class HeroSectionExample {
}API
| Property | Type | Default |
|---|---|---|
eyebrow | string | "" |
heading | string | "" |
align | "start" | "center" | "start" |
| Slot | For |
|---|---|
(default) | The sentence under the headline. |
actions | The main buttons or links. |
heading | The headline (defaults to heading). |
media | A picture, video or live demo. |
Size
1.1 KB gzipped for the component, plus the runtime, which every Zubra component on a page shares (up to 22.1 KB, all of it). On its own, with the parts of the runtime it uses, it's 17.4 KB.