Form card — Hero block
Prohero-form-card · for home, landing pages
Form card
The promise and what the visitor gets on one side, a framed form panel on the other: a quote or a demo that asks a few questions
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-form-cardUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import HeroFormCard from '@/components/trame/blocks/hero/hero-form-card.vue'
const props = {
title: "Your first outing on the river is on us",
lead: "Tell us when you’re free: a coach replies within two days with a Saturday slot, a boat and a crewmate.",
fields: [
{
name: "name",
label: "Name",
type: "text",
placeholder: "Jordan Ellis",
required: true
},
{
name: "email",
label: "Email address",
type: "email",
placeholder: "[email protected]",
required: true
}
],
submitLabel: "Book my free outing",
formAction: "trial.request",
consent: "Your answers are used only to arrange this outing and are deleted after three months.",
points: [
"A qualified coach in the launch beside you",
"Boats, oars and life jackets provided"
],
options: {
eyebrow: "Riverside Rowing Club",
formTitle: "Your free outing"
}
}
</script>
<template>
<HeroFormCard 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 |
| points | string[] | Wordsone thing the visitor gets or knows after sending, as the merchant states it |
| 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 · 5 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa short line above the title ("On quote") |
| formTitle | string | Wordsthe heading of the form’s panel ("Your request") |
| 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
- 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.
- Flows workflow tabs: a product explained by its flows: centred words over a tab row, each tab a short chain of steps.
- Globe beside: a team, a network of makers or depots, with more to say: the words at the left and a whole dotted globe at the right, its first places named on leaders; the merchant’s own places only.
- Globe rising: a brand whose argument is where it makes or ships, told in few words: the words centred over a large dotted hemisphere rising from the bottom edge, its pins named on hover and listed under it; the merchant’s own places only.
- Image overlay: one strong, wide picture of the shop’s own: the title and the action laid over it on a legible wash, the picture across the whole width.
- Image quiet: a calm shop or a picture busy with detail: the title centred (or at the start) on the page, the picture under it in a wide frame.