vibes.diy Make an app → Discord
creator docs · reference · generated

Board surface — how a board, tile or card game looks

This is the same document the Vibes code generator reads when it builds apps — rendered from prompts/pkg/llms/surface-board.md on every deploy, so it can't drift from what the platform actually does. Read it from your terminal any time with npx vibes-diy skills.

Loaded with the board-games skill, which holds the rules, the seeds, the turns and the access shapes. This doc is the board's look: the material it is dressed in, and the skin it is drawn with.

Dress the board in the game's world

A board in plain rounded rectangles plays fine and looks like a spreadsheet. Before drawing, pick one physical thing from the request's world that a player would recognise on a real table, and let it decide four parts of the board: the frame, the column header, what a mark looks like, and how a win shows. Everything but the material's own colour stays in the theme's token classes, so the dressing restyles with the palette.

Choose the material from the request, in this order:

  1. The request's own subject. A rollerblade club's bingo marks squares with skate wheels; a baby-shower bingo uses pacifiers or footprints; a road trip uses licence plates; a bird walk uses binocular rings; a wine night uses glass rings.
  2. The game's classic table. Bingo is a paper card with a dauber; checkers are poker chips on felt; chess is an inlaid wood board; word tiles are wooden letter tiles; sudoku is pencil on graph paper; mancala is seeds in carved pits; memory is a deck of card backs; a trivia board is a TV game-show wall.
  3. The look the app already has. When neither gives a strong picture, the board takes the shapes of the room's own components (its radius, its ledge shadow, its type).

Then dress the four parts:

  • Frame. The material's edge: a ruled paper card with an ink border (stroke-foreground), a felt table (fill-muted), an inlaid border, a game-show wall with gaps between panels.
  • Header. A bingo card's five column letters can spell a word from the theme instead of B-I-N-G-O: SKATE for a skate club, BIRDS for a bird walk, ROADS for a road trip. A header with exactly as many letters as columns reads as part of the card.
  • Mark. The thing a real player puts down: a dauber blot, a wheel, a sticker, a chip, a pencil cross. The words underneath stay readable, so a mark is translucent (opacity-60) or the text flips to fill-primary-foreground on a solid mark. A mark animates once when it lands (a scale or a quarter turn, 150–500 ms) and stays put under motion-reduce:transition-none.
  • Win. The table's own celebration: a stroke drawn through the line, the winning marks changing colour together, a game-show panel flip. The win line is stroke-accent drawn over the marks.

Two dressed bingo cards (the board-games skill's BingoBoard, with a different cell and frame):

  • Dauber on paper. Cells are square <rect>s with no gaps and stroke-foreground rules; a dark header band carries the theme word. A mark is a slightly lumpy blot — a <path> circle with uneven radii, rotated a little per cell from the seed — in fill-primary opacity-60, drawn above the cell and below the text.
  • Skate wheels (or any round token: chips, caps, coins). Each cell is a <circle> in fill-muted; a marked cell fills fill-foreground with fill-background text and gains a dashed tread ring (stroke-primary, strokeDasharray="6 5") that turns half a turn as it lands. The free centre is the hub, in fill-accent.
jsx// A dauber blot and a wheel, each one cell of a 100-unit grid centred on (cx, cy).
function Blot({ cx, cy, turn }) {
  return <path d={`M ${cx - 36} ${cy} q 2 -38 38 -37 q 37 3 35 39 q -3 34 -38 35 q -37 -2 -35 -37 z`} transform={`rotate(${turn} ${cx} ${cy})`} className="fill-primary opacity-60 transition-transform duration-200 motion-reduce:transition-none" />;
}
function Wheel({ cx, cy, on }) {
  // Drawn round (0, 0) inside a translated group, so a CSS rotate turns the ring about its own centre.
  return (
    <g transform={`translate(${cx} ${cy})`}>
      <circle r="44" className={on ? "fill-foreground" : "fill-muted"} />
      {/* Always mounted, so marking changes the rotation and the transition has a "from". */}
      <circle r="44" fill="none" strokeWidth="5" strokeDasharray="6 5" className={`stroke-primary transition duration-500 motion-reduce:transition-none ${on ? "rotate-180 opacity-100" : "rotate-0 opacity-0"}`} />
    </g>
  );
}

The same move on other boards: checkers as poker chips (two concentric <circle>s with a dashed edge stripe); a word-guess as wooden tiles (a <rect> with a lighter top edge, letters in the display face); sudoku as graph paper (thin stroke-border rules, thick box rules, entries in a handwritten-looking face and givens in the body face); memory as a deck (a card back with a pattern drawn from the deck's seed, flipped with a scaleX transition); mancala as carved pits (an ellipse with an inner shadow ring and seeds as small circles scattered from the seed).

Board surface — the board is the app

On a board game the board is the thing people came for, so the look's components only frame it: the title, a Stat or Badge for the score and the turn, Buttons for New game / Undo / Share, a Dialog for the win. Taste goes into the board itself — its material, tiles, pieces, texture and motion — and a board drawn from Cards, RowCards or one IconButton per square reads as an admin screen, whatever the palette.

On an app built from the UI's components (the default look or any look on its surface) the board takes the reskin technique, even when the person never asked for a look:

  • One wrapper. The app renders inside a root <div data-reskin> with <style>{SKIN}</style> as its first child, SKIN one module-level CSS string. A later "make it look like a 1970s wooden set" then lands in the same place.
  • Colour from the look's tokens. The board's CSS reads var(--surface), var(--ink), var(--purple), var(--up), var(--down) and var(--r-card), so the Look tab and a reskin restyle the board with the chrome. The material is the exception: a material the person named, or the game's classic table (walnut and maple inlay, green felt, slate), is that material's own colour, set once as a token on the wrapper (--felt: #2f6b4f;, --wood-light: #e2c296; --wood-dark: #8b5a34;) and read from there. A look token never stands in for a named material, so an inlaid wood board is wood on every look.
  • Plain elements for tiles and pieces. The board is SVG or a CSS grid of divs with the app's own class names (.board, .sq, .sq--dark, .piece), each cell a <g role="button"> or div role="button" tabIndex={0} as the board-games skill draws them. They take classes freely; the look's components never do.
  • Texture and motion on the board, capture-safe. Grain or felt is a gradient on .board; a piece slides with a transform transition and lands once; the first frame is already a full board.
jsximport React, { useState } from "react";
import { Badge, Button, Heading, Row, Stack } from "@vibes.diy/ui";

const SKIN = `
[data-reskin], body:has([data-reskin]) { --felt: #2f6b4f; }
[data-reskin] .board { display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); width: min(100%, 28rem); aspect-ratio: 1;
  padding: 10px; border-radius: var(--r-card); background: var(--ink); touch-action: manipulation; user-select: none; }
[data-reskin] .sq { display: grid; place-items: center; background: var(--surface); }
[data-reskin] .sq--dark { background: repeating-linear-gradient(135deg, var(--felt) 0 3px, color-mix(in srgb, var(--felt) 88%, var(--ink)) 3px 6px); }
[data-reskin] .piece { width: 76%; aspect-ratio: 1; border-radius: 50%; border: 3px dashed color-mix(in srgb, var(--surface) 60%, transparent);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ink) 45%, transparent); transition: transform 180ms ease; }
[data-reskin] .piece--red { background: var(--down); }
[data-reskin] .piece--black { background: var(--ink); border-color: var(--text-secondary); }
[data-reskin] .sq[aria-pressed="true"] .piece { transform: translateY(-4px) scale(1.06); }
`;

const START = Array.from({ length: 64 }, (_, i) => {
  const dark = (Math.floor(i / 8) + i) % 2 === 1;
  return !dark ? null : i < 24 ? "black" : i >= 40 ? "red" : null;
});

export default function App() {
  const [cells, setCells] = useState(START);
  const [held, setHeld] = useState(-1);
  const [turn, setTurn] = useState("red");

  // Any empty square takes the held piece here; a real game asks legalMoves(state) first (below).
  function tap(i) {
    if (cells[i] === turn) return setHeld(i);
    if (held < 0 || cells[i] !== null) return;
    setCells(cells.map((c, j) => (j === i ? turn : j === held ? null : c)));
    setHeld(-1);
    setTurn(turn === "red" ? "black" : "red");
  }

  function newGame() {
    setCells(START);
    setHeld(-1);
    setTurn("red");
  }

  return (
    <div data-reskin>
      <style>{SKIN}</style>
      <Stack gap={4}>
        <Row gap={2} align="center">
          <Heading level={1}>Checkers</Heading>
          <Badge tone={turn === "red" ? "down" : "idle"}>{turn} to move</Badge>
        </Row>
        <div className="board" role="group" aria-label="Checkers board">
          {cells.map((c, i) => (
            <div
              key={i}
              role="button"
              tabIndex={0}
              aria-label={`Square ${i + 1}${c ? `, ${c}` : ""}`}
              aria-pressed={held === i}
              className={(Math.floor(i / 8) + i) % 2 === 1 ? "sq sq--dark" : "sq"}
              onClick={() => tap(i)}
              onKeyDown={(e) => {
                if (e.key !== "Enter" && e.key !== " ") return;
                e.preventDefault();
                tap(i);
              }}
            >
              {c && <span className={`piece piece--${c}`} />}
            </div>
          ))}
        </div>
        <Row gap={2}>
          <Button variant="quiet" onClick={newGame}>
            New game
          </Button>
        </Row>
      </Stack>
    </div>
  );
}

The rule functions, seeds and access shapes are the board-games skill's; this is only where the board's look lives. The same move covers a puzzle grid, a card table (a .table in felt, .card faces as plain elements) and the HUD around a canvas or voxel world, where the canvas is the board and the components are the frame.