Vitral 0.2
Reference

Layout panels

The seven components an application is assembled from, and what each one is for.

Component libraries rarely have these, and every application ends up writing them: the panels that decide where things go. They are thin, flexbox and CSS grid underneath, with the arithmetic in @vitral/core so an adapter for another framework gets it for free, and they survive unstyled mode, because their layout is inline styles rather than classes.

The seven

ComponentForWhat it gives you
StackPanelOne line of childrenOrientation, spacing, alignment and wrapping. A flex box with the props named after what they do.
WrapPanelChildren that flow onto new linesitemWidth and itemHeight give every child the same size; lines pack at the start instead of stretching.
UniformGridEqual cellsRows and columns derived from the children when only one is given, with firstColumn for a gap before the first.
DockPanelRegions welded to the edges A slot per edge (#top, #bottom, #left, #right), and the default slot fills what is left. dockOrder decides who wins the corners.
GridRows and columns, by definitionStar sizing: columns="Auto,*,2*,120". GridItem places a child by 0-based row and column, with spans.
SplitViewA pane beside the contentinline, overlay, compactInline and compactOverlay; the floating modes light-dismiss and return focus.
SplitterPanels the reader resizesDrag a gutter, or focus it and use the arrow keys; Home and End take it to its limits.

An application shell, in one template

AppShell.vue
<DockPanel>
    <template #top><Toolbar /></template>
    <template #bottom><StatusBar /></template>

    <SplitView v-model:open="pane" display-mode="compactInline" :open-pane-length="240">
        <template #pane><Listbox :options="sections" /></template>

        <Grid columns="2*,Auto,*" :column-spacing="12">
            <GridItem :column="0"><DataGrid :value="rows" /></GridItem>
            <GridItem :column="2"><Panel header="Details" toggleable /></GridItem>
        </Grid>
    </SplitView>
</DockPanel>

That is the shape most desktop tools share: a toolbar docked to the top, a status strip to the bottom, a pane that collapses to a strip of icons, and a grid splitting the rest.

Star sizing

  • Auto: the track takes what its content needs.
  • *: one share of what is left. 2* takes twice the share of a *.
  • A number: pixels.
  • Anything else (20%, 10rem, minmax(8rem, 1fr)) passes through as CSS.

Row and column spacing are separate props, and a showGridLines flag outlines every cell while you are getting a layout right.