Figures stat band — Hero block
Prohero-figures-stat-band · for home, landing pages
Figures stat band
A number is the argument: a bordered band of three to five figures the merchant states
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/hero-figures-stat-bandUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import HeroFiguresStatBand from '@/components/trame/blocks/hero/hero-figures-stat-band.vue'
const props = {
title: "Learn interface design in the evening, from people who do it all day",
subtitle: "Northfield School of Design runs twelve-week courses, two evenings a week, in the studio or online. Every brief is real, every crit is in person.",
primaryAction: {
label: "See the April courses",
action: "courses"
},
secondaryAction: {
label: "Visit an open evening",
action: "open-evening"
},
stats: [
{
value: "16",
label: "students per cohort, never more"
},
{
value: "12 weeks",
label: "two evenings a week"
}
],
options: {
eyebrow: "Enrollment opens March 1",
note: "Pay in three installments, no interest"
}
}
</script>
<template>
<HeroFiguresStatBand v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe one promise, in a sentence (60 to 90 characters at most) |
| subtitle | string | Wordswhat it is and for whom, in one or two sentences |
| primaryAction* | PrimaryAction | the main button: its words and the page action it runs |
| secondaryAction | SecondaryAction | a quieter second action beside the main one: its words and the page action |
| stats* | Stat[] | the stats shown, in order |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
PrimaryAction primaryAction · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("Try for free") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
SecondaryAction secondaryAction · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("Try for free") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Stat stats[] · 2 props
| Prop | Type | Description |
|---|---|---|
| value* | string | Wordsthe figure as the merchant states it ("12,400") |
| label* | string | Wordswhat it counts |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa short chip above the title ("New") |
| note | string | Wordsfine print under the actions ("No bank card") |
| background | 'aurora' | 'pattern' | 'none' | the section’s background: aurora, pattern, none |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- Expressive motion, within its budget; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
primaryAction,secondaryAction
A hero section, for home, landing pages; it uses class-variance-authority, clsx, motion, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More hero blocks
- Event countdown: the days left to the start, from the organiser’s date, beside the register button: an event within a few weeks.
- Event date led: the date in very large numerals beside the title and place, one picture band beneath: a one- or two-day event.
- Event poster: the title set as a poster over a picture, the details in a ruled strip below: a festival, an exhibition, a season.
- Event replay on demand: a past event: a one-line recap and the replay action, never a register button; without a replay it is the recap alone.
- Finder: a product choice that needs a few questions: the first question shown, the real finder one click away.
- Float deck: the title set on the left and the pictures fanned on the right like a hand of cards, the first product in front: 2 to 4 products with one to lead, a more personal, collected opening.
- Float orbit: the title above, the pictures in a gentle arc under it, the middle one largest: 2 to 4 products, a calmer opening.
- Float scatter: the pictures around the title at different sizes and depths, as if set down on a table: 3 or 4 products that read well alone.