Layout components

This page describes components in live-web-view used to manage the layout of a page.

Centered Layout

The CenterLayout component centers it's content both vertically and horizontally.

Centered text.

Expand/Collapse source code
Copied
Copy source sections
Copy source as is
SSR/CSR
Can be used both on the server and on the client side.
Imports
import live-web.dom
import live-web-view.layout
Styles
static any[] use = [CenterLayout]
Content
CenterLayout{ 
    P`Centered text.`
}

Column layout

ColLayout is used to split it's content into two columns. The content automatically collapses on md breakpoint.

Left column content.

Right column content.

Expand/Collapse source code
Copied
Copy source sections
Copy source as is
SSR/CSR
Can be used both on the server and on the client side.
Imports
import live-web.dom
import live-web-view.layout
Styles
static any[] use = [ColLayout]
Content
ColLayout{
    Col{
        Content{
            P`Left column content.`
        }
    }
    Col{
        Content{
            P`Right column content.`
        }
    }
}

Column Layout breakpoint

ColLayout breakpoint can be configured to none/sm/md/lg using the breakPoint property. The following example breaks the layout at lg screen size:

Left column content.

Right column content.

Expand/Collapse source code
Copied
Copy source sections
Copy source as is
SSR/CSR
Can be used both on the server and on the client side.
Imports
import live-web.dom
import live-web-view.layout
Styles
static any[] use = [ColLayout]
Content
ColLayout{
    Col{
        Content{
            P`Left column content.`
        }
    }
    Col{
        Content{
            P`Right column content.`
        }
    }
}

Float layout

Float positions it's content inside it's relative parent in a corner. The content is positioned as absolute and doesn't interfere with the current layout. The position property is used to control the location of the content:

Float Top Left

Top Left

Expand/Collapse source code
Copied
Copy source sections
Copy source as is
SSR/CSR
Can be used both on the server and on the client side.
Imports
import live-web.dom
import live-web-view.layout
Styles
static any[] use = [Float]
Content
Float{ position: 'TL'
    P`Top Left`
}

Float bottom right

Bottom Right

Expand/Collapse source code
Copied
Copy source sections
Copy source as is
SSR/CSR
Can be used both on the server and on the client side.
Imports
import live-web.dom
import live-web-view.layout
Styles
static any[] use = [Float]
Content
Float{ position: 'BR'
    P`Bottom Right`
}