Request bar — Hero block
Prohero-request-bar · for home, landing pages
Request bar
One to three short fields in a single bar under a centred promise: an address to leave, a quick callback
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-request-barUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import HeroRequestBar from '@/components/trame/blocks/hero/hero-request-bar.vue'
const props = {
title: "Get the workshop’s catalog",
lead: "One email per season, with what’s new and the dates we’re in store.",
fields: [
{
name: "name",
label: "Name",
type: "text",
placeholder: "Camille Martin",
required: true
},
{
name: "email",
label: "Email address",
type: "email",
placeholder: "[email protected]",
required: true
}
],
submitLabel: "Subscribe",
formAction: "newsletter.join",
consent: "Your answers are used only to prepare this quote and are deleted after three months.",
options: {
eyebrow: "The workshop notebook"
}
}
</script>
<template>
<HeroRequestBar v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe promise, in one sentence ("A quote for your workshop in 48 hours") |
| lead | string | Wordsone or two sentences on what happens after sending the form |
| fields | Field[] | the form’s fields, in order |
| submitLabel* | string | Wordswhat the button does ("Get my quote") |
| formAction* | string | Actionthe page action that receives the form (posted by it) |
| consent | string | Wordswhat the answers are used for and the right to leave, as the merchant states it, under the button |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Field fields[] · 6 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Designthe field’s name as the page action receives it ("email", "company", "message") |
| label* | string | Wordswhat the field asks ("Email address") |
| type | 'email' | 'text' | 'tel' | 'textarea' | 'select' | the kind of field; text by default |
| placeholder | string | Wordsan example of the answer, not an instruction |
| required | boolean | true: the form is not sent without it |
| choices | string[] | Wordsone choice of a select, as the merchant words it |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa short line above the title ("On quote") |
| status | 'success' | 'error' | Datathe answer to the last submission, when the host re-renders with it |
| statusText | string | Wordswhat that answer says |
| 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 |
| 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:
formAction
A hero section, for home, landing pages; it uses @lucide/vue, @vueuse/core, 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
- Proof panel stacked: the same proof in a quieter, wider opening: the promise centred on top, the figures and the clients’ logos in two frosted panels side by side under it — the merchant’s own figures and clients only.
- Reel mosaic: the promise centred on a quiet pattern that lights up around the pointer (the grid with a few brief light streaks), then a calm bento of short muted clips within the page width: a studio, a tool or a library whose own work is the argument (the host’s own work only).
- Reel side: the mosaic turned on its side: a wide feature clip with up to three smaller ones under it on the start side, the promise beside them aligned to the start, over the same quiet pattern: a studio, a tool or a library that leads with one piece of its work and wants the words read alongside it (the host’s own work only).
- Reel tilted wall: the same centred promise over a wall of clips laid on a plane turned in 3D, running off both edges and fading at the foot: a body of work seen as a whole, more atmosphere than detail (the host’s own work only).
- Service side card: someone who sells a service: what is offered, with the one-line scope and the price of each, in a card beside the intro — the merchant’s own only.
- Shopfront facade: the shop’s front edge to edge, the invitation over its foot and the address and hours on a card set like a plaque beside the door: a shop whose street front is its best picture (a bakery, a florist, a bookshop).
- Shopfront shop window: the words, the address and the hours as a ruled timetable on the page’s ground, the front in a tall arched window with the inside pictures set against it: a calmer opening, or a front photographed close.
- Showcase framed media: a product or an app with a screenshot: the words on top, the picture in a frame running off the fold.