Code tabs list and code — Product tour block
Proproduct-tour-code-tabs-list-and-code · for landing, app pages
Code tabs list and code
Several distinct use cases, each with a line of explanation: the list at the left, the chosen one’s code at the right; the merchant’s own code only
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/product-tour-code-tabs-list-and-codeUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import ProductTourCodeTabsListAndCode from '@/components/trame/blocks/product-tour/product-tour-code-tabs-list-and-code.vue'
const props = {
title: "Place an order in three languages",
intro: "The shop’s API answers the same way, whatever your tool. Copy, paste, and the order is created.",
snippets: [
{
label: "JavaScript",
language: "JavaScript",
filename: "order.js",
summary: "The shop’s official client, server side.",
source: "const shop = createClient({ key: process.env.SHOP_KEY })\n\nconst order = await shop.orders.create({\n customer: 'cus_2048',\n lines: [{ product: 'speckled-stoneware-bowl', quantity: 2 }],\n shipping: 'pickup-point',\n})\n\nconsole.log(order.number) // \"C-10482\""
},
{
label: "Python",
language: "Python",
filename: "order.py",
summary: "The same calls, with the same field names.",
source: "shop = create_client(key=os.environ[\"SHOP_KEY\"])\n\norder = shop.orders.create(\n customer=\"cus_2048\",\n lines=[{\"product\": \"speckled-stoneware-bowl\", \"quantity\": 2}],\n shipping=\"pickup-point\",\n)\n\nprint(order.number) # \"C-10482\""
}
],
action: {
label: "Read the docs",
action: "docs"
}
}
</script>
<template>
<ProductTourCodeTabsListAndCode v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat integrating looks like, in a few words ("Three lines to place an order") |
| intro | string | Wordsone or two sentences: what the snippets show and for whom |
| snippets* | Snippet[] | 2 to 6 snippets, one visible at a time; one alone is a plain window |
| action | Action | the call to action: its words and the page action it runs |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Snippet snippets[] · 6 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe snippet’s name on its tab: a language, a use case or a file ("Node", "Create an order") |
| language | string | Designthe language it is written in ("TypeScript", "Shell"), shown on the window’s bar |
| filename | string | Wordsthe file it lives in ("order.ts") |
| path | string | Wordsthe folder of that file, with slashes ("src/routes"); snippets of one folder are grouped in the file tree |
| summary | string | Wordsone line on what this snippet does |
| source* | string | Wordsthe merchant’s own code, as written; never an invented package or API |
Action action · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhere the visitor reads more ("Read the documentation") |
| action* | string | Actiona named action of the page |
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 |
| 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
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
action
A product tour section, for landing, app pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.
More product tour blocks
- Cards: the same product seen by 2 to 4 kinds of visitor, each with its own picture and the page it leads to — the merchant’s own only.
- Code change diff panel: An explanation beside static, escaped added and removed code lines; the merchant’s own only.
- Code sample install band: A focused command panel followed by capability chips; the merchant’s own only.
- Code sample terminal split: Documentation and actions beside a static code panel; the merchant’s own only.
- Demo chapters side list: one real video with a chapter list beside its poster; nothing plays until asked: a demo that is worth watching — the merchant’s own only.
- Demo teaser: one framed screen that leans towards the pointer, a chip on it and an action: an invitation to try — the merchant’s own only.
- Dev showcase events table: Event names, trigger descriptions and supplied payload sizes; the merchant’s own only.
- Dev showcase language grid: Language or SDK cards with their own install command; the merchant’s own only.