Back to components
ComponentWidgetFree

Dino Runner Game React component

A canvas endless-runner in the style of the offline dino game, pixel-drawn running dino, procedurally spawned cactus obstacles, three difficulty speeds, tap/space/arrow-up to jump, and a high-score tracker.

About the Dino Runner Game component

Dino Runner Game is an endless runner in the style of the browser's offline dinosaur game. The dino runs to the right on its own, cacti come in at random gaps, and you jump over them with Space, the up arrow or a tap. Each cactus cleared is a point, the game speeds up as you go, and touching a cactus ends the run.

Players choose Easy, Medium or Hard before a run, which sets the starting speed, and defaultDifficulty sets which one is selected first. The high score is saved in localStorage, and storageKey keeps it separate when there is more than one game on a site. The game is drawn on a 320px tall canvas that fills the width of its container, and it stops while it is scrolled out of view. It can also open as a popup from a pill button.

When to use it

Use it on a 404 or offline page, a maintenance or launch countdown, or a developer portfolio, where the browser-dinosaur reference fits.

For a game with more going on, use Snake Game or Space Invaders Game.

Installation

Add the Dino Runner Game component to your project with the shadcn CLI. It lands in components/dino-runner-game.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/dino-runner-game

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install clsx tailwind-merge

More Widget components

Space Invaders Game
Free
Pong Game
Free
Glow Jump Widget
Free
Memory Match Game
Free
Spin to Win Wheel
Free
Minesweeper Game
Free