pixijs-scene-text
pixijs/pixijs-skills
Render styled text in PixiJS v8 with Text, BitmapText, HTMLText, and split variants for animation.
What is pixijs-scene-text?
Covers five text-rendering classes for PixiJS v8, each optimized for different trade-offs between styling fidelity, performance, and animation capability. Use Text for high-quality static labels, BitmapText for per-frame updates, HTMLText for rich markup, and SplitText/SplitBitmapText for per-character animation.
- Render canvas-quality styled text with Text class for full CSS-style fidelity
- Use BitmapText for cheap per-frame updates via pre-generated glyph atlas
- Render HTML/CSS markup via SVG with HTMLText for rich formatted content
- Expose per-character, per-word, and per-line containers with SplitText and SplitBitmapText
- Support inline colored tags and custom styling via tagStyles and TextStyle options
How to install pixijs-scene-text
npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-scene-text- Familiarity with pixijs-scene-core-concepts (leaves and transforms)
- Font files loaded via Assets.load for custom fonts
- BitmapFont.install() call before creating BitmapText instances with new fonts
How to use pixijs-scene-text
- 1.Choose a text variant based on your use case: Text for static labels, BitmapText for per-frame updates, HTMLText for rich markup, or SplitText/SplitBitmapText for per-character animation
- 2.Create a text instance using the options-object constructor with text and style properties
- 3.Configure styling via TextStyle, HTMLTextStyle, or BitmapFont options including fontFamily, fontSize, fill, stroke, and effects
- 4.Set anchor, position, and rotation using standard Container transforms
- 5.Add the text instance to the stage or a parent Container; text classes cannot have children
Use cases
- Display scores or timers that update every frame using BitmapText
- Animate individual characters or words with SplitText for short strings or SplitBitmapText for long strings
- Render styled dialog, menus, and error messages with Text for static labels
- Create mixed-format text with HTML tags like <b>, <i>, <br> using HTMLText
- Apply per-tag styling with inline colored tags like <red>Warning:</red> using tagStyles
- Game developers building UI and gameplay labels
- Graphics programmers optimizing text rendering performance
- Frontend developers creating animated text effects
- Game designers implementing dynamic score displays and timers
pixijs-scene-text FAQ
Use BitmapText for any value that changes every frame. Text re-rasterizes the entire string on each update (high cost), while BitmapText only repositions quads (very low cost).
Yes, use SplitText for short strings with rich styling, or SplitBitmapText for long strings or many instances. Both expose per-character, per-word, and per-line containers.
Load the font file via Assets.load({ src: 'font.woff2', data: { family: 'MyFont' } }), then set style.fontFamily: 'MyFont'. Works for Text and HTMLText.
tagStyles enables per-tag styling like <red>text</red>. Define tagStyles in your TextStyle or HTMLTextStyle; tags are only parsed when tagStyles has entries.
Use MSDF (Multi-channel Signed Distance Field) fonts for crisp scaling at any size. Generate with external tools like msdf-bmfont and load via Assets.load('font.fnt').
Full instructions (SKILL.md)
Source of truth, from pixijs/pixijs-skills.
name: pixijs-scene-text description: "Use this skill when rendering text in PixiJS v8. Covers Text for canvas-quality styled labels, BitmapText for cheap per-frame updates via glyph atlas, HTMLText for HTML/CSS markup via SVG, SplitText and SplitBitmapText for per-character animation, TextStyle, tagStyles, constructor options, TextOptions, HTMLTextOptions, BitmapText, SplitTextOptions, SplitBitmapTextOptions. Triggers on: Text, BitmapText, HTMLText, SplitText, SplitBitmapText, TextStyle, HTMLTextStyle, BitmapFont.install, tagStyles, fontFamily, wordWrap." license: MIT
PixiJS has five text-rendering classes that cover different trade-offs between styling, performance, and animation. Text renders to a canvas for full CSS-style fidelity. BitmapText reads from a pre-generated atlas for cheap updates. HTMLText renders an HTML fragment via SVG <foreignObject> for rich markup. SplitText and SplitBitmapText wrap the first two classes and expose per-character, per-word, and per-line containers for animation.
Assumes familiarity with pixijs-scene-core-concepts. All text classes are leaf nodes; they cannot have children. Wrap multiple text instances in a Container to group them.
Quick Start
const text = new Text({
text: "Hello PixiJS",
style: {
fontFamily: "Arial",
fontSize: 36,
fill: 0xffffff,
stroke: { color: 0x4a1850, width: 5 },
dropShadow: { color: 0x000000, blur: 4, distance: 6 },
},
});
text.anchor.set(0.5);
text.x = app.screen.width / 2;
text.y = 40;
app.stage.addChild(text);
All text classes use options-object constructors; positional (string, style) from v7 is not supported.
Related skills: pixijs-scene-core-concepts (leaves, transforms), pixijs-assets (font loading), pixijs-performance (BitmapText tradeoffs), pixijs-color (FillInput for fill/stroke), pixijs-scene-graphics (gradients and patterns reused via FillInput).
Variants
| Variant | Use when | Trade-offs | Reference |
|---|---|---|---|
Text | High-quality static or infrequent-update labels | Expensive to update (canvas re-draw + GPU upload) | references/text.md |
BitmapText | Scores, timers, gameplay labels, anything that changes every frame | Limited styling; fixed glyph atlas; requires MSDF for crisp scaling | references/bitmap-text.md |
HTMLText | Rich formatted text, mixed styles, real HTML tags | Async rendering (one frame delay); similar update cost to Text | references/html-text.md |
SplitText | Per-character animation with rich styling | Each char is a full Text; expensive for long strings | references/split-text.md |
SplitBitmapText | Per-character animation on long strings or dynamic content | Inherits BitmapText limitations (glyph atlas, no MSDF-free crispness) | references/split-bitmap-text.md |
When to use what
- "I need a styled static label" →
Text. Use for titles, menus, dialog, error messages. Seereferences/text.md. - "I need a score or timer that updates every frame" →
BitmapText. Updates only reposition quads; no canvas re-draw. Seereferences/bitmap-text.md. - "I need mixed formatting with
<b>,<i>,<br>" →HTMLText. Real HTML/CSS rendering via SVG. Seereferences/html-text.md. - "I need inline colored tags like
<red>Warning:</red>" →TextorHTMLTextwithtagStyles. Both support it. - "I need to animate each character individually" →
SplitTextfor short strings,SplitBitmapTextfor long strings or many instances. Seereferences/split-text.md/references/split-bitmap-text.md. - "I need CJK / Arabic / emoji-heavy text" →
TextorHTMLText.BitmapTextfails because the glyph set is too large for a single atlas. - "I need a custom font" → Load via
Assets.load({ src: 'font.woff2', data: { family: 'MyFont' } })first, then setstyle.fontFamily: 'MyFont'. Works forTextandHTMLText.
Update cost comparison
| Update trigger | Text | BitmapText | HTMLText | SplitText | SplitBitmapText |
|---|---|---|---|---|---|
Changing .text | High | Very low | High | Very high (N text re-renders) | Low (N quad repositions) |
Changing .style | High | Medium | High | Very high | Medium |
Moving (.x, .y) | Free | Free | Free | Free | Free |
| Rotating / scaling | Free | Free | Free | Free | Free |
"Free" = normal Container transform cost. "High" = new canvas draw + GPU upload. "Very low" = quad reposition only. Update strings that change per-frame only on BitmapText or SplitBitmapText.
Quick concepts
- Options-object constructors. Every v8 text class uses
new Text({ text, style, ... }). The v7(string, style)form is removed. tagStyles.TextandHTMLTextsupport per-tag styling viastyle.tagStyles. Tags are only parsed whentagStyleshas entries; otherwise<is treated literally.BitmapFont.install. Pre-generates an atlas before you create anyBitmapText. Without install, the firstBitmapTextwith a newfontFamilygenerates the atlas lazily.- MSDF fonts. Multi-channel Signed Distance Field fonts stay sharp at any size. Generate with external tools (e.g., msdf-bmfont), load via
Assets.load('font.fnt'). Requiresimport 'pixi.js/text-bitmap'in custom builds.
Common Mistakes
[HIGH] Updating Text.text every frame
Wrong:
app.ticker.add(() => {
scoreText.text = `Score: ${score}`;
});
Correct:
const scoreText = new BitmapText({ text: "Score: 0", style });
app.ticker.add(() => {
scoreText.text = `Score: ${score}`;
});
Every Text update re-rasterizes the whole string. Use BitmapText for any value that changes per-frame.
[HIGH] Positional constructor args
Wrong:
const text = new Text("Hello", { fontSize: 24 });
Correct:
const text = new Text({ text: "Hello", style: { fontSize: 24 } });
v8 removed the (string, style) form. All text classes use options objects.
[HIGH] Not importing pixi.js/text-bitmap in custom builds
Under skipExtensionImports: true or aggressive tree-shaking, Assets.load('font.fnt') silently returns raw data unless you add import 'pixi.js/text-bitmap'. The standard import { ... } from 'pixi.js' bundle includes the extension.
[MEDIUM] Adding children to a text instance
Every text class sets allowChildren = false. Wrap in a Container to group text with other content.
API Reference
Related skills
More from pixijs/pixijs-skills and the wider catalog.

pixijs-ticker
Control PixiJS v8 render loop with frame-rate-independent animation and priority-based callbacks.

pixijs
Router skill for PixiJS v8—directs to specialized sub-skills for rendering, scene objects, assets, and advanced graphics.

pixijs-accessibility
Add screen reader and keyboard navigation to PixiJS v8 apps via AccessibilitySystem.

pixijs-application
Create and configure PixiJS v8 Applications with renderers, stage, and lifecycle management.

mysql
Plan and review MySQL/InnoDB schema, indexing, query tuning, transactions, and operations.

neki
Overview and information about Neki, the sharded Postgres product by PlanetScale. Load when working with Neki-related tasks and the need to scale or shard postgres. Load when facing Postgres scaling or sharding issues.