@jsvision/ui / row
Function: row()
row(...
args):Group
Defined in: ui/src/view/dsl/flex.ts:168
Build a horizontal flex container (direction: 'row') — children sit left to right. Pass an optional Flex props object first, then the child views.
A falsy child (null/undefined/false) is skipped, so row(grow(main), showAside && aside) composes without a manual .add() dance.
Parameters
args
[Flex, ...Child[]] | Child[]
An optional Flex props object followed by child views (or just child views); a falsy child is skipped.
Returns
A Group with layout.direction = 'row' and the (truthy) children added in order.
Example
ts
import { View, row, fixed, grow, type DrawContext } from '@jsvision/ui';
class Panel extends View {
constructor(private readonly label: string) { super(); }
draw(ctx: DrawContext) { ctx.fill(' ', ctx.color('window')); ctx.text(1, 0, this.label); }
}
// A fixed-width sidebar beside a growing main pane.
const sidebar = new Panel('sidebar');
const main = new Panel('main');
const body = row(fixed(sidebar, 20), grow(main));