logoalt Hacker News

Taffy: A flexible, high-performance, cross-platform UI layout library

69 pointsby robin_realalast Thursday at 2:56 PM27 commentsview on HN

Comments

nicoburnstoday at 2:51 PM

I maintain Taffy: AMA.

I am currently in the process of building a wider browser engine / GUI toolkit on top of it (https://github.com/dioxuslabs/blitz). As part of that I am implementing a lot of the messier parts of CSS layout (floats, etc), and also grinding on fixing all the WPT tests which we track here: https://blitz.is/status/wpt/css/css-flexbox.

The vision is a complete standalone implementation of the web layout algorithms that can be easily embedded (with individual algorithms enabled/disabled on a pay what you use basis), and which can also be part of a modular ecosystem of browser engine components that make it easier for people to create new browser engines.

Beyond Blitz, some notable users are:

- Servo which uses it only for CSS Grid

- Zed which uses it via it's GPUI toolkit.

show 5 replies
jdniertoday at 5:30 PM

There are Python bindings via the stretchable library.

https://github.com/mortencombat/stretchable

chrisweeklytoday at 2:58 PM

Closely-related tangent: for an amazing resource showing how to leverage CSS from first principles, see https://every-layout.dev

hereonout2today at 2:17 PM

An unfortunate name for certain audiences in the UK!

show 4 replies
LoganDarktoday at 1:58 PM

I would be interested in something like Apple's constraint layout system. Nested flexboxes and grids can do a lot, but I kinda fell in love after seeing constraint layout. Even how window resizing is represented as a constraint with a certain priority too!

show 3 replies
troupotoday at 2:02 PM

My opinion is that no one should re-implement CSS layout orimitives and algorithms. Those are rather unique in how (by necessity and quirks if history) awkward, stange and bolted on they are.

Explore other layout ideas. E.g. https://stackoverflow.com/questions/53911631/gui-layout-algo...

show 2 replies
righthandtoday at 2:33 PM

<strike>This project IMO should admit it's taken a lot of it's inspiration from Clay, a C layout immediate mode UI library: https://github.com/nicbarker/clay/</strike>

EDIT: Was wrong, see reply to this comment, need my coffee...still not a good excuse

show 1 reply