Zubra UI
Code for
GitHub

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.

Small classes, real ovens, and a starter to take home. Weekends in Portland and online. Book a class See the schedule

This one has no events: it shows what it's given.

Source: hero-section.zb, and its registry item.

Install

Compiled (any project)
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
One file, no dependencies (3.7 KB gzipped)
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
.zb source (to edit it with Zubra)
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
No build: a script tag, straight from this site
HTML
<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

index.html
<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>
Example.jsx
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>
  );
}
Example.vue
<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('-') } } }) -->
Example.svelte
<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>
example.component.ts
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

Properties (each is also an HTML attribute of the same name, unless marked)
PropertyTypeDefault
eyebrowstring""
headingstring""
align"start" | "center""start"
Slots
SlotFor
(default)The sentence under the headline.
actionsThe main buttons or links.
headingThe headline (defaults to heading).
mediaA 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.

Theme

Every component reads shadcn/ui's CSS variables, so any shadcn theme works. Pick a look or a colour, or paste a theme's CSS.

Look: colours, fonts, corners and motion

Accent colour