Layout system

Yue uses Facebook Yoga as layout engine, which provides Flexbox style layout system.

Yue does not support CSS itself, it only uses the concept of Flexbox for layout, and you have to manually set style for each View.

view.setStyle({flexDirection: 'column', flex: 1})

It should be noted that not all CSS properties are supported, and there is no plan for support of tables, floats, or similar CSS concepts.

View and Container

In Yue all widgets are inherited from the virtual class View, which represents a leaf node in the layout system. The Container is a View that can have multiple child Views, in the layout system the child Views of Container are treated as child nodes.

There are Views that can have content view like Group or Scroll, but their content views are treated as root nodes in layout system, instead of being child nodes of their parents.

Following code is an example of list view.

const listView = gui.Scroll.create()
const contentView = gui.Container.create()
contentView.setStyle({flexDirection: 'column'})

for (let i = 0; i < 100; ++i) {
  const item = gui.Label.create(String(i))
  const g = Math.floor(155 / 100 * i + 100)
  item.setBackgroundColor(gui.Color.rgb(100, g, 100))


Style properties

For a complete list of supported style properties, it is recommended to read the documentation of Yoga.