spst-gallery-01
These examples do not call the service. Model rendering is a static placeholder.
Source commit: d204666f04a0ee7b6f18543f8aec414b4128874e · shadcn build 4.23.1
Noto Sans JP · @fontsource/noto-sans-jp 5.3.1 · OFL-1.1
Preview
Install (publication pending)
These URLs are planned for publication and are not available yet. Inspect existing file differences before installing; do not use --overwrite by default.
npx shadcn@latest add https://spritestack.dev/r/spst-gallery-01.jsonAdd to registries in components.json
{"registries":{"@spritestack":"https://spritestack.dev/r/{name}.json"}}npx shadcn@latest add @spritestack/spst-gallery-01Targets React 19, Tailwind v4 and shadcn projects with src/. Layouts without src/ are unverified. Installation copies source files; updates are not automatic.
import "./styles/spritestack/theme.css";
<div className="spst-theme" data-theme="light">
{/* Render components here. */}
</div>Pass an element inside .spst-theme to container / portalContainer for portals. Self-host Noto Sans JP weights 400, 600 and 700 in your application; system-ui is the fallback.
Dependencies
react@19.2.4- spst-badge
- spst-button
- spst-card
- spst-category-strip
- spst-command-copy
- spst-input
- spst-model-card
- spst-sample-data
- spst-site-footer
- spst-site-header
- spst-theme
- spst-viewer-controls
- spst-viewer-frame
Props / API
Generated by parsing the actual source. Rows marked … reference inherited React / Radix public types. — means no default is declared in this function parameter. See the type declarations for union-specific requirements.
src/components/spritestack/blocks/gallery-01.tsx
Gallery01
Gallery01({ locale = "ja", messages }: SampleProps = {})| Prop | Type | Required | Default | Event |
|---|---|---|---|---|
… | SampleProps | — | — | — |
Destructuring defaults (including inherited props)
locale = "ja"Inspect type declarations and source
"use client";
// 出典: SpriteStack デザインシステム設計 §4.2・§4.4(Issue 313)。基本部品は同梱の shadcn/ui 派生を合成。
import { useState } from "react";
import { Badge } from "../../ui/badge";
import { Button, buttonVariants } from "../../ui/button";
import { Card } from "../../ui/card";
import { Input } from "../../ui/input";
import { CategoryStrip } from "../category-strip";
import { CommandCopy } from "../command-copy";
import { ModelCard } from "../model-card";
import { SiteFooter } from "../site-footer";
import { SiteHeader } from "../site-header";
import { ViewerControls } from "../viewer-controls";
import { ViewerFrame } from "../viewer-frame";
import { getComponentMessages } from "./component-messages";
import { getSampleData } from "./sample-data";
import { getSampleMessages, type SampleProps } from "./sample-messages";
export function Gallery01({ locale = "ja", messages }: SampleProps = {}) {
const m = getSampleMessages(locale, messages);
const { demoModels, demoLinks } = getSampleData(locale, messages);
const c = getComponentMessages(locale);
const [category, setCategory] = useState("all");
const [search, setSearch] = useState("");
const [selected, setSelected] = useState<string>(demoModels[0].id);
const [mode, setMode] = useState<"2d" | "3d">("3d");
const [gap, setGap] = useState(0);
const [rotation, setRotation] = useState("");
const model = demoModels.find((item) => item.id === selected) ?? demoModels[0];
const models = demoModels.filter(
(item) => (category === "all" || item.category === category) && item.title.includes(search),
);
return (
<div data-block="gallery-01" className="min-w-0 bg-background text-foreground">
<SiteHeader
locale={locale}
homeHref="#sample-home"
links={demoLinks}
currentPath="#sample-home"
/>
<div className="grid min-w-0 gap-5 p-4 lg:grid-cols-3">
<section className="grid min-w-0 content-start gap-4 lg:col-span-2" aria-label={m.gallery}>
<h1 className="text-xl font-(weight:--spst-font-weight-heading)">
{m.findModelsForYourGame}
</h1>
<Input
type="search"
aria-label={m.searchModels}
placeholder={m.searchModels}
value={search}
onChange={(event) => setSearch(event.target.value)}
/>
<CategoryStrip
messages={c.CategoryStrip}
categories={[
{ value: "all", label: m.all },
{ value: "items", label: m.items },
{ value: "nature", label: m.nature },
]}
value={category}
onValueChange={setCategory}
layout="wrap"
/>
<div className="grid min-w-0 grid-cols-2 gap-3 xl:grid-cols-4">
{models.map((item) => (
<ModelCard
messages={c.ModelCard}
key={item.id}
{...item}
selected={selected === item.id}
onSelect={() => setSelected(item.id)}
/>
))}
</div>
{models.length === 0 && <p role="status">{m.noMatchingModels}</p>}
</section>
<section className="min-w-0" aria-label={m.selectedModel}>
<Card className="min-w-0 gap-3 p-4 [overflow-wrap:anywhere]">
<h2 className="text-xl font-(weight:--spst-font-weight-heading)">{model.title}</h2>
{/* 描画枠の状態表示を保ち、外側のカードに枠と影を集約する。 */}
<div className="[&>[data-component=viewer-frame]]:border-0 [&>[data-component=viewer-frame]]:bg-transparent [&>[data-component=viewer-frame]]:p-0 [&>[data-component=viewer-frame]]:shadow-none">
<ViewerFrame
messages={c.ViewerFrame}
variant="wide"
controls={
<ViewerControls
messages={c.ViewerControls}
mode={mode}
onModeChange={setMode}
gap={gap}
onGapChange={setGap}
gapMin={0}
gapMax={4}
onRotate={(direction) =>
setRotation(
direction === "left" ? m.rotateLeftRequested : m.rotateRightRequested,
)
}
/>
}
>
<p className="p-4">
{model.title} {m.renderingNotice}
</p>
</ViewerFrame>
</div>
<p role="status" className={rotation ? "text-sm" : "sr-only"}>
{rotation}
</p>
<div className="flex flex-wrap items-center justify-between gap-2">
<span>
{m.author} {model.author}
</span>
<Badge>{model.license}</Badge>
</div>
<p className="text-sm">{m.staticModel(model.title)}</p>
<Button
messages={c.Button}
variant="outline"
onClick={() => setRotation(m.detailsNotice)}
>
{m.openDetails}
</Button>
<a href="#sample-download" download className={buttonVariants()}>
{m.downloadSs}
</a>
<CommandCopy
messages={c.CommandCopy}
text={`https://example.invalid/models/${model.id}`}
variant="request"
label={m.copyLink}
/>
</Card>
</section>
</div>
<SiteFooter locale={locale} links={[{ href: "#sample-docs", label: m.usageExample }]} />
</div>
);
}
Accessibility requirements
- Give inputs a label or accessible name and associate errors with aria-describedby. Do not communicate state using color alone.
- Provide model names and image fallbacks. Icon-only buttons need accessible names.
- Provide dialog and sheet titles and descriptions, and place portals inside the theme. Test Tab, arrow keys, Escape and focus restoration in the consuming app.
- Slider requires a name and finite min < max. ToggleGroup requires a nonempty single value. The parent controls pending state.
Reference images: 01・02 · Dark mode and error states extend the reference design.