Product editor full — Form block
Proform-product-editor-full · for app pages
Product editor full
Edit product content and ordered pictures beside publishing and pricing controls.
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/form-product-editor-fullUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import FormProductEditorFull from '@/components/trame/blocks/form/form-product-editor-full.vue'
const props = {
title: "Edit the rain jacket",
product: {
id: "veste",
name: "Rain jacket",
summary: "A relaxed fit and an adjustable hood for getting around on foot. The outer fabric keeps light showers out.",
price: 8900,
compareAt: 10900,
status: "draft",
slug: "veste-de-pluie",
collectionIds: [
"plein-air"
],
image: "https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=800&q=80",
images: [
"https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=800&q=80",
"https://images.unsplash.com/photo-1673712060934-34358642511b?w=800&q=80"
],
alt: "Jackets displayed on hangers",
seoTitle: "A rain jacket for everyday outings",
seoDescription: "Discover our lightweight jacket, its sizes and its colors. Read the care tips before you order.",
variants: [
{
id: "0-0",
size: "S",
colour: "Orange",
sku: "VPL-S-OR",
stock: 4
},
{
id: "0-1",
size: "S",
colour: "Olive",
sku: "VPL-S-OL",
stock: 5
}
]
},
collections: [
{
id: "plein-air",
name: "Outdoors"
},
{
id: "quotidien",
name: "Everyday essentials"
}
],
save: "product.save"
}
</script>
<template>
<FormProductEditorFull v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s heading |
| product* | Product | Datathe product being edited |
| collections* | Collection[] | Datathe collections the product can belong to |
| save | string | Actionsaves the edits: through the host it receives `{ id, patch }` (the fields changed, prices in cents); posted natively, the form sends the fields by name (prices in the main unit) |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 25 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| price* | number | an amount in cents |
| compareAt | number | the price before the merchant’s reduction |
| currency | string | DesignISO 4217, EUR by default |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| images | string[] | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the main picture shows |
| brand | string | Wordsthe brand or maker |
| category | string | Wordsthe product’s category, e.g. "Knitwear" |
| summary | string | Wordsone short line on the product |
| badge | string | Wordsa short tag the merchant set ("New", "Handmade") |
| rating | number | the average of the shop’s own stored reviews |
| reviewCount | number | how many stored reviews the rating averages |
| available | boolean | false: sold out; true or absent: can be bought |
| stock | number | the real stock, when the merchant shows it |
| maxQuantity | number | the most one order may hold of it, as the merchant set it (one per customer, a limited run) |
| options | Option[] | the product’s options and their values, e.g. sizes |
| highlights | Highlight[] | a few key facts the merchant set, shown on the product’s card |
| status* | 'draft' | 'active' | 'archived' | the product’s status: draft, active, archived |
| collectionIds* | (string | number)[] | Datathe ids of the collections it belongs to |
| seoTitle | string | Wordsthe title search engines show |
| seoDescription | string | Wordsthe description search engines show |
| slug* | string | Designthe last part of the product’s address |
| variants* | Variant[] | Datathe product’s variants, each with its size, colour and stock |
Option product.options[] · 2 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Wordsthe option’s name, e.g. "Size" |
| values* | string[] | Wordsits values, e.g. "S", "M", "L" |
Highlight product.highlights[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe property ("Material", "Capacity") |
| value* | string | Wordsits value, as the merchant states it ("Washed linen", "50 cl") |
Variant product.variants[] · 5 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Datathe variant’s id |
| size* | string | Wordsthe variant’s size |
| colour* | string | Wordsthe variant’s colour |
| sku* | string | Datathe variant’s stock reference |
| stock* | number | how many are in stock |
Collection collections[] · 6 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe category’s name |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the category’s picture shows |
| count | number | how many products it holds |
| summary | string | Wordsone short line on the category |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| 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 |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| 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
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
record.save - Reads
products,categoriesfrom your app
A form section, for app pages; it uses @vueuse/core, class-variance-authority, clsx, tailwind-merge.
More form blocks
- Multi step stepper top: a creation flow of three to five steps: numbered steps across the top, the form beside tips and a live preview.
- Multi step wizard vertical: six steps or more, or long ones: a vertical step list on the left and a single card on the right.
- Option group editor inline: every group as a card, one under the other, beside a preview of the whole product as the buyer will choose it: the options section of a product’s own edit page.
- Option group editor list: one ruled row per group with its rule and options in words, moved up or down, opened one at a time to edit: a menu with many groups to put in order.
- Option group editor sheet: the groups listed on the page and the one chosen open in a side sheet, its fields above the buyer’s preview and the save bar: a back office where a dish or a product is edited in a panel over its list.
- Record label left: a record with many plain fields, as in settings: each label and its help on the left, its field on the right.
- Record page: create or edit one record on its own page: titled sections as cards, short fields paired, a sticky save bar.
- Record panel: the same form in a drawer or a narrow column: one field per row, no cards, a sticky save bar.