Skip to content

Children and layouts

Pass default child content through reusable application shells.

On this page

A layout is an ordinary component with a children: Node prop. Use it for repeated application chrome, such as a header and a body area.

src/layouts/Panel.iru
<view>
    <Column gap={16.0} padding={24.0}>
        <Text text={props.title} />
        <Children />
    </Column>
</view>
<rust>
use inrux::prelude::*;
pub struct Props {
    pub title: &'static str,
    pub children: Node,
}
</rust>

Import the layout and place child nodes between its tags:

rs
use crate::layouts::panel as Panel;
xml
<Panel title="Settings">
    <Input model:value={name} />
    <Button text="Save" @click={save} />
</Panel>

The parent still owns state.name and save. Panel renders the supplied default content at <Children />. You can reuse Panel in separate views without a router.

Folder convention

Use src/views/ for screens, src/layouts/ for shared shells, and src/components/ for smaller reusable pieces. The compiler resolves explicit module imports; these names are conventions, not magic file routes.

Current content limits

Default content is an owned Node and the current compiler composes it eagerly. Named slots, scoped slots, lazy content factories and transparent nested <view> groups are not implemented. <Slot /> is an accepted alias for the default outlet. Use the current capitalized <Children /> spelling in new examples.

For a larger working layout, inspect ShowcaseLayout.iru.

Inrux · Built with Nuxt Content, IPEX, and Akaza UI.