Form card — Hero block

Pro

hero-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-card

Usage

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.

PropTypeDescription
title*stringWordsthe promise, in one sentence ("A quote for your workshop in 48 hours")
leadstringWordsone or two sentences on what happens after sending the form
fieldsField[]the form’s fields, in order
submitLabel*stringWordswhat the button does ("Get my quote")
formAction*stringActionthe page action that receives the form (posted by it)
consentstringWordswhat the answers are used for and the right to leave, as the merchant states it, under the button
pointsstring[]Wordsone thing the visitor gets or knows after sending, as the merchant states it
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Field fields[] · 6 props
PropTypeDescription
name*stringDesignthe field’s name as the page action receives it ("email", "company", "message")
label*stringWordswhat the field asks ("Email address")
type'email' | 'text' | 'tel' | 'textarea' | 'select'the kind of field; text by default
placeholderstringWordsan example of the answer, not an instruction
requiredbooleantrue: the form is not sent without it
choicesstring[]Wordsone choice of a select, as the merchant words it
Options options · 5 props
PropTypeDescription
eyebrowstringWordsa short line above the title ("On quote")
formTitlestringWordsthe heading of the form’s panel ("Your request")
status'success' | 'error'Datathe answer to the last submission, when the host re-renders with it
statusTextstringWordswhat that answer says
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa 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).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour 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:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo 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.

All 102 hero blocks