Skip to main content
Version: 0.45

Horizontal Layout

The horizontal layout is an application layout built for public-facing portals. Instead of the default layout's collapsible sidebar menu, it places navigation along the top of the page, which suits landing pages and public sites where a full-width content area matters. It is part of Core, so it is available to every Shesha application without any extra packages.


What the layout provides

The horizontal layout supports the pieces you need for a public portal.

FeatureDescription
HeaderA configurable header, set from a form.
FooterA configurable footer, set from a form.
BreadcrumbsA breadcrumb trail for the current page.
Sticky headingAn optional setting that keeps the heading fixed at the top of the page as the user scrolls. It is off by default.
Show headingControls whether the heading area is shown. It is on by default.

Shesha ships with pre-configured header and footer forms for the public portal, named header-public-portal and footer-public-portal in the Shesha module. You can use these as they are or replace them with your own.


Choosing the layout for your application

The layout your application uses is set in one place in the front-end project, in the layout constants file (mainLayout/constant.ts). The LAYOUT_MODE constant accepts one of two values.

ValueLayout
defaultLayoutThe traditional layout with a collapsible sidebar menu.
horizontalLayoutThe horizontal top-navigation layout described on this page.

To switch your whole application to the horizontal layout, set the constant to horizontalLayout.


Switching layouts at runtime

If you need to choose the layout dynamically rather than fixing it for the whole application, use the useLayoutSelection hook. It exposes the current layoutMode, a setLayoutMode function to change it between defaultLayout and horizontalLayout, and a wrapper that applies the chosen layout to a page.

tip

Use the constant when the whole application uses one layout. Reach for the useLayoutSelection hook only when you need different parts of the application to use different layouts.


Horizontal Menu component

The horizontal layout is paired with the Horizontal Menu component, available in the form designer toolbox. It renders the top navigation and gives you detailed control over how the menu looks.

Appearance

The Appearance tab controls how the menu behaves and how its items look.

Overflow string

Controls what happens when the menu has more items than fit across the available width. The options are dropdown, menu, and scroll.


The menu styles group controls the look of the menu items themselves.

GroupWhat you can set
ColorsItem colour and background, hover colour and background, selected colour and background, and sub-item colour and background.
FontFamily, size, weight, colour, and alignment.
GapThe spacing between menu items.
Custom stylesStyle overrides for the default, hover, selected, and sub-menu states.

Container styles

The container styles group controls the menu's outer container.

GroupWhat you can set
DimensionsWidth, minimum and maximum width, and height, minimum and maximum height.
BorderBorder colour, width, style, and radius.
BackgroundColour, gradient, image, or stored file.
ShadowOffset, blur, spread, and colour.
Margin and paddingSpacing around and inside the container.
Custom stylesStyle overrides for the container.