Skip to content

@jsvision/ui / grow

Function: grow()

grow<V>(view, n?): V

Defined in: ui/src/view/dsl.ts:136

Give a view a flex-grow size: it takes a share of the container's leftover main-axis space proportional to n. Mutates the view's layout.size (preserving its other layout props) and returns the same view, so it composes inline inside a col/row.

Type Parameters

V

V extends View

Parameters

view

V

The view to size.

n?

number = 1

The flex weight (default 1). Two grow(v, 1) children split the space evenly; a grow(v, 2) child gets twice the share of a grow(v, 1) sibling.

Returns

V

The same view, for inline chaining.

Example

ts
import { row, grow } from '@jsvision/ui';

// `main` takes twice the width of `aside`.
const body = row(grow(aside, 1), grow(main, 2));