pixijs/pixi-react is a UI-focused project on GitHub with 2.9k stars, written primarily in TypeScript. Write PIXI apps using React declarative style
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Simply the best way to write PixiJS applications in React Write PixiJS applications using React declarative style 👌
@pixi/react is an open-source, production-ready library to render high performant PixiJS applications in React.
Features
React v19 support
PixiJS v8 support
Getting Started
Quick Start
If you want to start a new React project from scratch then we recommend Create React App, but @pixi/react should work with any React application (Remix, Next.js, etc).
To add @pixi/react to an existing React application, just install the dependencies:
One of the most important concepts to understand with v8 is extend. Normally @pixi/react would have to import all pf Pixi.js to be able to provide the full library as JSX components. Instead, we use an internal catalogue of components populated by the extend API. This allows you to define exactly which parts of Pixi.js you want to import, keeping your bundle sizes small.
To allow @pixi/react to use a Pixi.js component, pass it to the extend API:
defaultTextStyle is a convenience property. Whatever is passed will automatically be assigned to Pixi.js's TextStyle.defaultTextStyle.
[!NOTE]
This property is not retroactive. It will only apply to text components created after defaultTextStyle is set. Any text components created before setting defaultTextStyle will retain the base styles they had before defaultTextStyle was changed.
destroyOptions
When an <Application> is unmounted, it will call the destroy() method on the Pixi.js application instance. Provide this prop to override the default DestroyOptions (the second argument to destroy()). See Pixi.js's destroy documentation for more info.
extensions
extensions is an array of extensions to be loaded. Adding and removing items from this array will automatically load/unload the extensions. The first time this is handled happens before the application is initialised. See Pixi.js's extensions documentation for more info on extensions.
rendererDestroyOptions
When an <Application> is unmounted, it will call the destroy() method on the Pixi.js application instance. Provide this prop to override the default RendererDestroyOptions (the first argument to destroy()). See Pixi.js's destroy documentation for more info.
resizeTo
The <Application> component supports the resizeTo property, with some additional functionality: it can accept any HTML element or it can take a React ref directly.
All other components should be included in your IDE's intellisense/autocomplete once you've installed/imported @pixi/react. If it's exported from Pixi.js, it's supported as a component with the pixi prefix. Here's a selection of commonly used components:
The pixiGraphics component has a special draw property. draw takes a callback which receives the Graphics context, allowing drawing to happen on every tick.
The extend API will teach @pixi/react about your components, but TypeScript won't know about them nor their props. If you're using Typescript, check out our docs for Typescript Users.
Hooks
useApplication
useApplication allows access to the parent PIXI.Application created by the <Application> component. This hook will not work outside of an <Application> component. Additionally, the parent application is passed via React Context. This means useApplication will only work appropriately in child components, and in the same component that creates the <Application>.
For example, the following example useApplicationwill not be able to access the parent application:
import {
Application,
useApplication,
} from '@pixi/react'
const ParentComponent = () => {
// This will cause an invariant violation.
const { app } = useApplication()
return (
<Application />
)
}
Here's a working example where useApplicationwill be able to access the parent application:
useTick allows a callback to be attached to the Ticker on the parent application.
import { useTick } from '@pixi/react'
const MyComponent = () => {
useTick(() => console.log('This will be logged on every tick'))
}
useTick optionally takes an options object. This allows control of all ticker.add options, as well as adding the isEnabled option. Setting isEnabled to false will cause the callback to be disabled until the argument is changed to true again.
import { useState } from 'react'
import { useTick } from '@pixi/react'
const MyComponent = () => {
const [isEnabled, setIsEnabled] = useState(false)
useTick(() => console.log('This will be logged on every tick as long as `isEnabled` is `true`'), isEnabled)
return (
<sprite onClick={setIsEnabled(previousState => !previousState)}>
)
}
[!CAUTION]
The callback passed to useTickis not memoised. This can cause issues where your callback is being removed and added back to the ticker on every frame if you're mutating state in a component where useTick is using a non-memoised function. For example, this issue would affect the component below because we are mutating the state, causing the component to re-render constantly:
@pixi/react already offers types for built-in components, but custom components need to be added to the library's type catalogue so it knows how to handle them. This can be achieved by adding your custom components to the PixiElements interface. Here's what it may look like to add the viewport component from our earlier extend example:
// global.d.ts
import { type PixiReactElementProps } from '@pixi/react'
import { type Viewport } from 'pixi-viewport'
declare module '@pixi/react' {
interface PixiElements {
viewport: PixiReactElementProps<typeof Viewport>;
}
}
Now you'll be able to use your custom component in your project without any type errors!
Unprefixed Elements
If you like to live life on the wild side, you can enable unprefixed Pixi elements (i.e. <container> instead of <pixiContainer>) by adding the UnprefixedPixiElements interface to the PixiElements interface.
// global.d.ts
import { type UnprefixedPixiElements } from '@pixi/react'
declare module '@pixi/react' {
interface PixiElements extends UnprefixedPixiElements {}
}
The prefixed and unprefixed elements have the same functionality, but we recommend sticking to the prefixed components to avoid collisions with other libraries that add intrinsic elements to JSX (such as react-dom and @react-three/fiber).
[!IMPORTANT]
Some components conflict with other libaries, such as <svg> in react-dom and <color> in @react-three/fiber. To address this the pixi prefixed elements are always available, even after injecting the unprefixed elements.
Extending Built-in Components
The props for built-in components are available on the PixiElements type and can be used to extend the built-in types.
import { type PixiElements } from '@pixi/react'
export type TilingSpriteProps = PixiElements['pixiTilingSprite'] & {
image?: string;
texture?: Texture;
};
The most recent commit recorded on pixijs/pixi-react was 10 months ago, based on the GitHub push timestamp. The repository has 210 forks — one of the better signals of community interest.
How does pixijs/pixi-react compare to other Frontend projects?
pixijs/pixi-react is tracked by TopGit in the Frontend category, with 2.9k GitHub stars and written in TypeScript. Browse the Frontend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does pixijs/pixi-react have?
pixijs/pixi-react has 2.9k GitHub stars — refresh the page for the live number, or check github.com/pixijs/pixi-react. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is pixijs/pixi-react open source?
Yes — pixijs/pixi-react ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/pixijs/pixi-react.
What is pixijs/pixi-react?
pixijs/pixi-react (pixijs/pixi-react) is a TypeScript project on GitHub. From the project's own README: Write PIXI apps using React declarative style
Where do I read more about pixijs/pixi-react?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/pixijs/pixi-react is the definitive source.
Read full README in the tab above.
Want a second opinion on pixi-react?
Ask an AI that can read this page — one click and you get its take on pixi-react.