List ranked — Article block

Pro

article-list-ranked · for article, home pages

List ranked

Big numerals and pictures alternating sides: a ranking or a countdown the visitor reads with pleasure

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/article-list-ranked

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import ArticleListRanked from '@/components/trame/blocks/article/article-list-ranked.vue'

const props = {
title: "8 ways to make your bag last",
lead: "From storage to repair: what we tell people every week at the workshop.",
items: [
{
title: "Let it breathe",
text: "A bag stored in plastic sweats. Keep it in the open air, in a cotton dust bag, away from the radiator.",
image: "https://images.unsplash.com/photo-1473188588951-666fce8e7c68?w=1600&q=80",
alt: "A patinated brown leather satchel resting on a block of stone"
},
{
title: "Condition the leather twice a year",
text: "A dab of cream, a soft cloth, ten minutes. The leather stays supple and the patina grows richer.\n\nAvoid household oils: they stain.",
image: "https://images.unsplash.com/photo-1637759292654-a12cb2be085e?w=1600&q=80",
alt: "Cognac-brown leather, a close-up of a fold and a seam",
link: {
label: "Read the care guide",
action: "article",
record: {
id: "entretien"
}
}
}
],
options: {
eyebrow: "Workshop tips"
}
}
</script>

<template>
<ArticleListRanked v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
title*stringWordsthe article’s title ("8 ways to make a bag last")
leadstringWordswhat the list is for, in two lines
items*Item[]the items shown, in order
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Item items[] · 6 props
PropTypeDescription
title*stringWordsthe item’s title
text*stringWordsthe entry’s text; a blank line starts a new paragraph
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows
productProductDatathe product the entry points to, if any
linkLinkthe link: its words and the page action it runs
Product items[].product · 19 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
compareAtnumberthe price before the merchant’s reduction
currencystringDesignISO 4217, EUR by default
imagestring | nullPicturethe main picture; null or absent: the product has none yet
imagesstring[]Picturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the main picture shows
brandstringWordsthe brand or maker
categorystringWordsthe product’s category, e.g. "Knitwear"
summarystringWordsone short line on the product
badgestringWordsa short tag the merchant set ("New", "Handmade")
ratingnumberthe average of the shop’s own stored reviews
reviewCountnumberhow many stored reviews the rating averages
availablebooleanfalse: sold out; true or absent: can be bought
stocknumberthe real stock, when the merchant shows it
maxQuantitynumberthe most one order may hold of it, as the merchant set it (one per customer, a limited run)
optionsOption[]the product’s options and their values, e.g. sizes
highlightsHighlight[]a few key facts the merchant set, shown on the product’s card
Option items[].product.options[] · 2 props
PropTypeDescription
name*stringWordsthe option’s name, e.g. "Size"
values*string[]Wordsits values, e.g. "S", "M", "L"
Highlight items[].product.highlights[] · 2 props
PropTypeDescription
label*stringWordsthe property ("Material", "Capacity")
value*stringWordsits value, as the merchant states it ("Washed linen", "50 cl")
Link items[].link · 3 props
PropTypeDescription
label*stringWordswhere it leads ("Read the full guide")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
Options options · 3 props
PropTypeDescription
eyebrowstringWordsthe section ("Tips")
countdownbooleannumber from the last to the first, as in a countdown list
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
moneyformats a price, given in cents
asseta picture’s address as your app serves it
Linkyour router’s link component
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
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: items[].link

A article section, for article, home pages; it uses @lucide/vue, clsx, motion, tailwind-merge.

More article blocks

  • Layout prose: an ordinary article: a centred reading column, the cover wide above it, topics and the next reads below.
  • Layout split header: a feature or a launch story with a portrait or square cover: the cover beside the title, standfirst and byline (and the opening quote, when the article starts on one), the body centred below.
  • Layout steps: a how-to: a strip of key facts, then numbered steps each with its picture.
  • Long guide toc rail: a long guide with several headings: a sticky "on this page" rail with the article’s dates beside the text.
  • Passage strip cards: Equal excerpt cards for real extracts of linked articles only.
  • Passage strip stacked big: One large opening extract and a quiet reading list, for real linked extracts only.
  • Quiz all at once: every question in one column, the score at the end: a short quiz read like an article.
  • Quiz cards: questions as cards side by side: a light quiz of three to six questions that invites a try.

All 29 article blocks