DocsPlugins

Storefront

App-store screens for a plugin to fill with its own items: a rail, search, a hero and sections, item pages, Updates, Library and What’s new.

The storefront plugin is a library: it adds no screen of its own. The Marketplace is made of it. A plugin that lists or sells things uses it for its admin screens, and gives them its data. To add it:

sluurp plugin add storefront

Use it in your plugin’s admin screen

Name it in your plugin’s plugin.json ("deps": { "storefront": "^0.2.0" }), then import its screens from beside yours:

admin/shop.tsx
import { StoreShell, Hero, Section, Details, setWords } from "../../storefront/admin/lib/store";

setWords(tr);

export default function Shop() {
  return (
    <StoreShell rail={rail} current={at} onGo={go} query={query} onQuery={setQuery} placeholder="Search the shop">
      <Hero items={featured} onOpen={open} action={(item) => (item.status === "installed" ? "Open" : "Get")} />
      <Section title="New" items={newest} onOpen={open} />
    </StoreShell>
  );
}

Each item is a StoreItem: an id and a name, with an optional pitch, description, icon, cover, publisher, rating, version and a pill for its price or state. The screens show what they are given and call you back (onOpen, onGo, onQuery): what an item is, what it costs and what installing it does stay your plugin’s.

The screens are made of the admin’s own components, so they look like the rest of the admin. setWords hands them your words in the reader’s language, and setGlyphs your icons for icon:<name>.

Besides StoreShell, Hero and Section there are CategoryPage, Row, Group, Details (an item’s page with editions, add-ons, reviews and requirements), Updates, Library, WhatsNew, VersionNotes and ReviewDialog.

View as Markdown