npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pixi-table-layout

v1.0.1

Published

A simple flex-like layout library

Readme

pixi-table-layout

pixi-table-layout is a very simple layout library for PixiJS.

The easiest way to see it in action is to look at the examples.

It's a work-in-progress. Contributions welcome.

If you like this, you may like my other PixiJS library pixi-actions.

Installing

npm install pixi-simple-ui

Import required types:

import Table, { CellAnchor } from 'pixi-table-layout';

Usage

The crux of the layout system is the Table class. It's a PIXI.Container that manages the size and position of its child elements.

Creating a Table

You can create an add a table to the stage as with any other PIXI.Container. Be sure to set the table's size as appropriate; this is what determines the bounds of its child elements.

const root = new Table();
root.setSize(500, 500);
container.addChild(root);

If you are using a table to manage layout of the whole stage, and you want to take advantage of the automatic resizing capabilities, it makes sense to add a resize listener. For example, if you are using the resizeTo option, and adding the root directly to the stage:

await app.init({ resizeTo: window });

const root = new Table();
app.stage.addChild(root);
function resizeTable() {
	root.setSize(app.renderer.width, app.renderer.height);
}
app.renderer.on('resize', resizeTable);
resizeTable();

Layout

Tables are made up of rows, and rows are made up of cells. Rows and cells have a basis, which determines how much room they take up:

  • number - the size in pixels to take up
  • string of the form "10%" - the percentage of the total space in pixels
  • null (default) - all remaining space is divided equally by items with a null-basis

That is, a row with a basis of 50 will have a height of 50px. A cell with a basis of 25% will take up 25% of the total available width.

A cell can also have any number of elements. An element is a PIXI.Container, a sizing strategy and an anchor. Each of the cell's elements are added to the table, and the position and size of each are managed according to the sizing strategy and anchor.

| Sizing strategy| Details | |:---|:---| | null | Default. Do not size the element, manage only the position. | | 'contain' | Set size as large as possible whilst still fitting within the cell. Maintain aspect ratio. | | 'cover' | Set size to the minimum size such that the cell is entired covered. Maintain aspect ratio. | | 'stretch' or 'cover!' | Set size to the exact size of the cell. Ignore aspect ratio. | | grow | If the cell is larger than the initial size, grow the element to fit the cell. Maintain aspect ratio. | | grow! | If the cell is larger than the initial size, grow the element to fit the cell. Ignore aspect ratio. | | shrink | If the cell is smaller than the initial size, shrink the element to fit the cell. Maintain aspect ratio. | | shrink! | If the cell is smaller than the initial size, shrink the element to fit the cell. Ignore aspect ratio. |

Cell anchor is a PIXI.Point representing the x and y anchors. There are some self-explanatory helper constants:

  • CellAnchor.TopLeft
  • CellAnchor.Top
  • CellAnchor.TopRight
  • CellAnchor.Left
  • CellAnchor.Middle (default)
  • CellAnchor.Right
  • CellAnchor.BottomLeft
  • CellAnchor.Bottom
  • CellAnchor.BottomRight

API

Add rows, cells and elements to the table using these methods:

  • Table.row(basis: Basis = null)
  • Table.cell(basis: Basis = null)
  • Table.element(element: PIXI.Container, strategy: SizingStrategy = null, anchor: PIXI.Point = null)

You can turn on debug drawing which draws a red outline around each cell:

  • Table.debug = true;

It is recommended to disable prettier for the table definition so you can use the indentation to visualise the layout.

Examples

All of these examples are show with debug draw on.