Skip to main content

RandomWords

Generates random words per category for creative exercises and quick prompts.

Example structures

Basic

{
"type": "RandomWords",
"data": {
"categories": [
{ "category": "People", "words": ["Teacher", "Student", "Doctor"] },
{ "category": "Places", "words": ["School", "Hospital", "Park"] }
]
}
}

With hint box and sound

{
"type": "RandomWords",
"sound": { "hostonly": false },
"data": {
"background": "assets/bg-creative.jpg",
"theme": "dark",
"categories": [
{ "category": "Adjectives", "words": ["Brave", "Silent", "Curious"] },
{ "category": "Objects", "words": ["Lantern", "Map", "Key"] }
],
"hintBox": [
{ "letter": "P", "text": "Place" },
{ "letter": "C", "text": "Conflict" }
]
}
}

Properties

KeyTypeDefaultDescription
data.categories{ category: string; words: string[] }[]Categories and their word lists. Each list must contain ≥ 1 word.
data.hintBox{ letter: string; text: string }[]Optional hints rendered in a side panel (“Hinweise”).
data.backgroundstringBackground asset key/path passed to the Background component.
data.theme"light" | "dark"Preferred. Sets UI theme via useTheme.
data.darkTextbooleanLegacy. Inverted into theme (true → light text off).
soundobject (inherited)Optional background audio handled by the base node.

Behavior

  • Builds a map from categories and shows one card per category.
  • Randomize all: “Neue Wörter” sets a new word for every category.
  • Randomize one: “Neues Wort” on a card replaces only that category’s word.
  • Avoids repeating the previous word within a category when multiple options exist.
  • State is client-local; there is no server sync. Each participant can draw their own words.
  • Re-entering the node resets the selection.

Visual design

  • Responsive layout: grid of cards in the main area; hint box on the side (landscape) or below (portrait).
  • Card styling: rounded container, category title, large word text, and a small action button.
  • Background image rendered via <Background background={...} path={workshop.workshopKey} />.
  • UI labels in this component are currently German (“Neues Wort”, “Neue Wörter”, “Hinweise”).

Use cases

  • Brainstorming prompts, improv games, story starters.
  • Constrained writing (e.g., adjective + place + object).
  • Warm-ups where each participant gets different prompts.

Technical notes

  • Props:

    interface Props {
    workshop: WorkshopPayload;
    node: NodePayload; // node.nodeData per the table above
    }
  • Randomization:

    getRandomWord(key, prev) { /* picks from words[], avoids prev if possible */ }
  • Theme handling:

    • If theme is set, setTheme(theme === 'dark').
    • Else if darkText is set, setTheme(!darkText) (legacy path).
tip
  • Each words array must not be empty; otherwise selection breaks.
  • Categories are independent; duplicates across categories are possible by design.
  • Since selection is not synchronized, don’t use this node when a single shared draw is required without extending it with server state.