Interactive · Gutenberg
Tic-Tac-Toe block for WordPress
Playable Tic-Tac-Toe game with AI opponent, score tracking, custom symbols, and multiple difficulty modes.
Get Blockenberg
Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.
What it actually does
Playable Tic-Tac-Toe game with AI opponent, score tracking, custom symbols, and multiple difficulty modes.
Inspector panels on this block: Content, Game Settings. Those titles come from index.js, not from a shared template.
Behavior controls: “Default Mode” options: 🤖 Player vs AI, 👥 Player vs Player; “AI Difficulty” options: Easy (random), Medium (smart), Hard (minimax).
Where to find it
Gutenberg inserter → Interactive → search “Tic-Tac-Toe” (block name `blockenberg/tic-tac-toe` in block.json). Style it in the sidebar after insert.
How to use Tic-Tac-Toe block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “Tic-Tac-Toe”, insert it. Category: Interactive.
- Configure inspector controls that exist on this block. Open Content. Set “Show Title”, “Show Subtitle”, “Show Score”, “Default Mode”.
- Check the published page. The view script reads HTML data attributes: data-opts, data-uid. The block editor preview may not run the same view script.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| Show Title | On/off toggle in the inspector. On by default. Saved as `showTitle`. |
| Show Subtitle | On/off toggle in the inspector. On by default. Saved as `showSubtitle`. |
| Show Score | On/off toggle in the inspector. On by default. Saved as `showScore`. |
| Default Mode | Select control; the chosen value is saved on the block. Options: 🤖 Player vs AI; 👥 Player vs Player. block.json default: ai. Saved as `defaultMode`. |
| AI Difficulty | Select control; the chosen value is saved on the block. Options: Easy (random); Medium (smart); Hard (minimax). block.json default: hard. Saved as `aiDifficulty`. |
| Player Symbol | Text field in the inspector. block.json default: X. Saved as `playerSymbol`. |
| AI / P2 Symbol | Text field in the inspector. block.json default: O. Saved as `aiSymbol`. |
| Max Width (px) | Numeric range control in the inspector. Range 300–800. block.json default: 480. Saved as `contentMaxWidth`. |
| Accent Color | Color control in the inspector. block.json default: #6366f1. Saved as `accentColor`. |
| X Symbol Color | Color control in the inspector. block.json default: #ef4444. Saved as `xColor`. |
| O Symbol Color | Color control in the inspector. block.json default: #3b82f6. Saved as `oColor`. |
| Cell Background | Color control in the inspector. block.json default: #ffffff. Saved as `cellBg`. |
| Win Line Color | Color control in the inspector. block.json default: #22c55e. Saved as `winLineBg`. |
| Grid Lines | Color control in the inspector. block.json default: #d1d5db. Saved as `gridLine`. |
| Section Background | Color control in the inspector. block.json default: #eef2ff. Saved as `sectionBg`. |
| Card Background | Color control in the inspector. block.json default: #ffffff. Saved as `cardBg`. |
| Title Color | Color control in the inspector. block.json default: #312e81. Saved as `titleColor`. |
What the front-end script actually does
- The view script reads HTML data attributes: data-opts, data-uid.
- It writes to localStorage in the visitor’s browser, not to wp_options.
- JavaScript functions that perform the math: saveScore.
When this is the right block
- Playable Tic-Tac-Toe game with AI opponent, score tracking, custom symbols, and multiple difficulty modes — that is the job of Tic-Tac-Toe, not a generic content block.
- Use it when you need the editor control labeled “Show Title”, which exists on this block’s inspector.
- It matches pages about tic-tac-toe, game, noughts.
- The math runs in the visitor’s browser after publish — no extra calculator plugin.
Notes from the implementation
viewScript: this folder’s frontend.js is enqueued on the front end for this block.
FAQ
How do I add the Tic-Tac-Toe block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Tic-Tac-Toe”. It sits under Interactive. After insert, open Content and set “Show Title”, “Show Subtitle”, “Show Score”, “Default Mode”.
Does Tic-Tac-Toe need a server or extra plugin?
No. After Blockenberg is active, the view script runs in the browser with the values you saved on the block.
Is the Tic-Tac-Toe Gutenberg block free?
Yes. Tic-Tac-Toe ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style Tic-Tac-Toe to match my theme?
Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Content, Game Settings).
Related interactive blocks
Bingo Card
Interactive 5×5 Bingo card with number calling, win detection, and celebration animations.
Snake Game
Classic Snake game playable in the browser. Keyboard and on-screen touch controls, high-score tracking, multiple speed levels and color themes.
2048 Game
The classic sliding-tile 2048 puzzle. Swipe or use arrow keys to merge tiles and reach the 2048 tile.
Dice Roller
Interactive dice roller supporting d4, d6, d8, d10, d12, d20 and d100. Roll multiple dice, see individual results, totals, and past roll history.
Interactive Steps
Step-by-step wizard or process block with clickable numbered steps that reveal different content panels.
Memory Game
Interactive card-flip memory matching game with emoji themes, difficulty levels, move counter, timer, and best score tracking.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert Tic-Tac-Toe from the Gutenberg inserter.