Tabs

TabLayout organizes content into multiple sections and allow users to navigate between them.

Basic TabLayout

This is tab 1

This is tab 2

This is tab 3

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
import live-web-view.content
Styles
static any[] use = [TabLayout]
Content
TabLayout{
    TabHeader{
        TabButton{ content: [T`Tab 1`] }
        TabButton{ content: [T`Tab 2`] }
        TabButton{ content: [T`Tab 3`] }
    }
    TabContent{
        TabPane{ 
            Content{
                H1`This is tab 1`
            }
        }
        TabPane{ 
            Content{
                H1`This is tab 2`
            }
        }
        TabPane{ 
            Content{
                H1`This is tab 3`
            }
        }
    }
}

TabLayout from data

You can create tabs from a data objects:

Heading 1

Heading 2

Heading 3

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.overlay
import live-web-view.content
Styles
static any[] use = [Dropdown]
Content
TabLayout{
    id: tabLayout
    Array data = [1, 2, 3]
    TabHeader{
        children: tabLayout.data.map(d => {
            return TabButton{
                content: [T.(`Tab ${d}`){}]
            }
        })
    }
    TabContent{
        children: tabLayout.data.map(d => {
            return TabPane{ 
                Content{
                    H1.(`Heading ${d}`){}
                }
            }
        })
    }
}