Layout Showcase

used for parent of entire site such as www.sveltekit-ui.com

Component Documentation

Component Name

Layout

Builder Function Name

create_layout_manager

Description

manages a high-level app layout with nav bar, optional full navigation panel, confetti effects, dark theme toggling, and more

Use like example

Config

PropertyTypeDefaultDescription
is_dark_themeboolean

true

sets the initial dark/light theme mode

full_nav_linksarray

an array of link objects for the full navigation panel

nav_bar_linksarray

an array of link objects for a simplified or top nav bar

is_show_hamburgerboolean

true

if true, displays a hamburger menu icon for toggling full nav

is_all_nav_bar_hiddenboolean

false

completely hides the nav bar if true

is_nav_bar_hidable_from_scrollboolean

false

if true, allows the nav bar to hide on downward scrolling

is_nav_bar_hidden_from_scrollboolean

false

indicates whether the nav bar is currently hidden from scroll

is_full_nav_preventedboolean

false

prevents the user from opening the full nav if true

is_full_nav_toggled_onboolean

false

if true, the full nav panel is open

border_radiusnumber

0

border radius for certain nav bar styling, in rem

nav_margin_xnumber

0

horizontal margin for the nav bar

nav_margin_topnumber

0

top margin for the nav bar

nav_margin_bottomnumber

0

bottom margin for the nav bar

nav_main_padding_ynumber

0.5

vertical padding inside the nav bar

nav_main_padding_xnumber

1

horizontal padding inside the nav bar

breakpoint_splitsobject

[object Object]

defines screen width breakpoints for layout adjustments

faviconsobject

optionally contains { favicon, favicon_inactive }, updated on document visibility change

Methods

MethodDescriptionParametersReturns
handle_scroll

marks that user is scrolling; sets is_at_top=false, is_at_bottom=false, etc.

No Params

void
handle_scrollend

detects if scrolled to top/bottom at scroll end, updates manager states

No Params

void
set_base_theme

checks document.dataset.theme or system preference, sets is_dark_theme accordingly

No Params

void
set_is_at_top

manually sets is_at_top to given boolean

input: boolean

void
set_is_at_bottom

manually sets is_at_bottom to given boolean

input: boolean

void
set_theme

updates is_dark_theme and sets the theme data attribute/cookie

is_dark_theme_input: boolean

void
set_full_nav_height

stores the measured height of the full nav panel (used for responsiveness checks)

input: number

void
set_is_full_nav_toggled_on

sets whether the full navigation panel is open

input: boolean

void
set_screen_height

updates the overall screen height in the manager

input: number

void
set_screen_width

updates the overall screen width in the manager

input: number

void
set_nav_bar_height

updates the nav bar’s current pixel height

input: number

void
set_is_navigating

indicates a route transition is in progress (shows a loading overlay, etc.)

input: boolean

void
to_home

convenience method to navigate user to '/' using svelte's goto

No Params

void
goto_path

navigates user to a given route, closes full nav if open

slashed_path: string (ex: '/about')

void
init

constructs the layout manager, setting initial states, creating sub-managers for alerts, confetti, dark theme switch, etc.

config: object

void

Returned Properties

PropertyTypeDescription
is_dark_themeboolean

true if the current theme is dark

faviconsobject

contains { favicon, favicon_inactive } for dynamic updates

breakpointsobject

derived state with booleans for sm, md, lg, xl, xxl

full_nav_linksarray

an array of link objects for a full nav panel

nav_bar_linksarray

link objects for a top nav bar

is_show_hamburgerboolean

if true, shows a hamburger icon to toggle full nav

screen_widthnumber

the current window width

screen_heightnumber

the current window height

is_all_nav_bar_hiddenboolean

true if the entire nav bar is forcibly hidden

shown_nav_bar_heightnumber or null

the current nav bar height if visible, else null

is_nav_bar_hidable_from_scrollboolean

allows nav bar to hide on scroll down

is_nav_bar_hidden_from_scrollboolean

the current scroll state: nav is hidden or not

is_nav_bar_shownboolean

true if the nav bar is currently displayed

is_full_nav_preventedboolean

disables opening the full nav

is_full_nav_toggled_onboolean

state of the full nav toggle

is_full_nav_shownboolean

true if the full nav is actually displayed

nav_bar_heightnumber or null

the measured nav bar height in px

border_radiusnumber

general border radius for nav styling

nav_margin_xnumber

horizontal margin for the nav

nav_margin_topnumber

top margin for the nav

nav_margin_bottomnumber

bottom margin for the nav

nav_main_padding_ynumber

vertical padding inside the nav bar

nav_main_padding_xnumber

horizontal padding inside the nav bar

is_navigatingboolean

true if the app is in the middle of a page navigation

client_interfaceobject or null

data from get_user_interface if screen size is known

breakpoint_splitsobject

holds the numeric widths for sm, md, lg, xl

nav_link_clicksnumber

count of how many nav links have been clicked

is_at_topboolean

true if user has scrolled to the top of the page

is_at_bottomboolean

true if user has scrolled to the bottom of the page

hovered_route_namestring or null

the route name over which the user is currently hovering

available_content_heightnumber

calculated screen height minus shown nav bar height

full_nav_heightnumber or null

the measured height of the full nav

is_full_nav_largeboolean

true if the full nav is over half the available screen content height

confetti_managerobject

manages confetti display with a full screen overlay

alert_managerobject

manages global alerts

dark_theme_managerobject

a dark_theme checkbox manager controlling is_dark_theme

icon
Sponsored byContibase