TBX Docs
ExercisesCatalogue

FindWords

Word search puzzles where users select hidden words in a letter grid

FindWords renders a word search grid where words are hidden horizontally or vertically. Empty cells in the grid definition are filled with random letters. Users click or click-drag to select cells; when the selection matches a defined word, it is marked as found.

Import

import { FindWords } from '@bside-tech/tbx-ui/components';

Example

Find Words
Find and select the hidden words in the grid.
CATDE
AGHIJ
RLMNO
PQDOG
UVWXY
  • CAT
  • CAR
  • DOG
Time: 0.000s
<FindWords
  grid={[
    ["C", "A", "T", "", ""],
    ["A", "", "", "", ""],
    ["R", "", "", "", ""],
    ["", "", "D", "O", "G"],
    ["", "", "", "", ""],
  ]}
  words={[
    { startRow: 0, startCol: 0, direction: "horizontal", solution: "CAT" },
    { startRow: 0, startCol: 0, direction: "vertical", solution: "CAR" },
    { startRow: 3, startCol: 2, direction: "horizontal", solution: "DOG" },
  ]}
/>

Grid format

The grid is a 2D array of strings, similar to Crosswords:

  • Letter — Cell that is part of a hidden word (shows that letter).
  • '' or ' ' — Empty cell (filled with a random letter at render time).

Words format

Each word entry describes one hidden word:

FieldTypeDescription
startRownumberRow index where the word starts
startColnumberColumn index where the word starts
direction'horizontal' | 'vertical'Word orientation
solutionstringThe word text (for validation)

Props

Prop

Type

Labels

Override button and time labels via the labels prop:

<FindWords
  grid={grid}
  words={words}
  labels={{
    reset: "Ripristina",
    time: "Tempo:",
  }}
/>

Style

Tailwind v4 is available for customisations. Pass classes via the classNames prop, or override CSS variables for fine-grained control.

CSS Classes

KeyElement
rootRoot wrapper
gridLetter grid table
cellEach cell
wordListWord list (legend) container
wordItemEach word in the legend
resetButtonReset button
timeTime display wrapper

CSS Variables

Scoped under .tbx-findwords:

VariablePurpose
--findwords-cell-sizeCell width and height (default 2rem, can be overridden by cellSize prop)
--findwords-cell-bgCell background
--findwords-cell-borderCell border
--findwords-cell-textCell letter color
--findwords-cell-selectedCell when selected (click/drag)
--findwords-cell-foundCell when word is found (correct)
--exercise-action-bg, --exercise-action-borderReset button
--exercise-result-neutral, --exercise-result-correct, --exercise-result-wrongResults text

Found words in the legend use --exercise-accent-color for text. Time display uses --exercise-accent-color when words have been found. Content uses --exercise-layout-content-font-size. Icon color follows --exercise-layout-icon-color.

Interaction

  • Click on a word cell to select it.
  • Click and drag across cells to select a horizontal or vertical line. Release to check: if the selection (forward or reverse) matches a word, it is marked as found.
  • Found words are highlighted green and crossed off the word list.
  • Use Reset to clear found words and try again.

Hook

Use useFindWordsExercise when building custom word search interfaces:

import { useFindWordsExercise } from "@bside-tech/tbx-ui/hooks";
import type { FindWordsEntry } from "@bside-tech/tbx-ui/hooks";

const {
  displayGrid,
  wordResults,
  selectedCells,
  isCorrect,
  setSelection,
  clearSelection,
  commitSelection,
  reset,
  getWordId,
} = useFindWordsExercise({
  solutionGrid: grid,
  words: words,
  seed: 0,
});

On this page