Layout

Layout component helps user to deal with layout structure in page level. This component API design is highly inspired by Ant Design’s Layout.

Example

Basic Usage
Layout is a flex component which direction switches between row and column on each wrap.
View code
Sidebar has three variants: Dark, Grey, and White (default). This variants also affect the SideMenu components rendered inside it.
View code
Navbar has two variants: Dark (default) and White. These variants also affect the Menubar components rendered inside it.
View code
Logo Variants
NavbarVariants is used for Logo variants, which have two variants: Dark (default) and White.
note: the example below uses different logo images for two variants, the size is a bit different
View code
Scrolling content
Topmost Layout has height of 100vh and vertically scrollable by default. If you want to set to specific height, just override with style prop manually.
View code
Different Structure
Topmost Layout uses column direction by default. If you have a layout like example below, where the topmost Layout is in row, you can pass "row" to direction prop. This kind of layout is used by Material-UI documentation.
View code
Keyboard navigation with SkipNav
By default, topmost Layout adds SkipNav component, and collects all mounted regions (i.e. Main, Sidebar, but Navbar is not by default).
Below is an example to demonstrate how this can be helpful for keyboard users. The example overlays the Layout with pointer-events:none, so you are not able to interact using mouse. Instead, try to use Tab to click the red “Alert” button.
On a side note, this is also one way to do a QA Accessibility Test.
View code
If for some reason you want to completely remove the default SkipNav, you can specify skipNav to be null in topmost Layout.
View code
Disabling individual SkipNav
To disable individual region skip nav link, you can specify boolean skipNavable to each Main, Sidebar, or Navbar. This can be helpful when, for example, Main is the only thing on the page, it doesn’t make much sense to jump to a region which is just next to it.
Below is an example where Main is not skippable, so the only thing left is “Skip to sidebar”.
View code

References

API

Layout
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
directionLayoutDirections
Default direction depends on the parent. On the top level, default direction is column. This is normally when you have an app with navigation bar on top.
The next Layout within a Layout will change direction, e.g. if parent has column as its direction, the child Layout's is row, vice versa.
skipNavReactElement<any, any>
Top Layout adds SkipNav component by default.
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
dividerPropsHTMLAttributes<HTMLDivElement> & { as?: any; ref?: HTMLDivElement; }
imgPropsAvatarProps
srcstring
variantNavbarVariants
Main
Prop nameTypeDefaultDescription
asanymain
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
skipNavablebooleantrue
Whether the region is added to SkipNav component.
Prop nameTypeDefaultDescription
asanyheader
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
elevationLevelnumber2
skipNavableboolean
Whether the region is added to SkipNav component.
variantNavbarVariantsdark
Prop nameTypeDefaultDescription
asanyaside
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
collapsedboolean
initialCollapsedboolean
onCollapsedChange(collapsed: boolean) => void
skipNavablebooleantrue
Whether the region is added to SkipNav component.
variantSidebarVariantswhite
SidebarCollapse
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
colorTypeColorTypes
Set color based on theme. If color is specified, that prop is used instead of this.
disabledboolean
Equivalent to button's disabled property.
keyboardClickKeysstring[]
loadingboolean
onBlurFocusEventHandler<HTMLDivElement>
onClickMouseEventHandler<HTMLDivElement>
onKeyDownKeyboardEventHandler<HTMLDivElement>
onKeyUpKeyboardEventHandler<HTMLDivElement>
onMouseDownMouseEventHandler<HTMLDivElement>
onMouseLeaveMouseEventHandler<HTMLDivElement>
onMouseUpMouseEventHandler<HTMLDivElement>
onReleaseEventHandler<SyntheticEvent<HTMLDivElement, Event>>
Callback that's triggered after click i.e. mouseup and keyup of enter or space.
onTouchEndTouchEventHandler<HTMLDivElement>
onTouchStartTouchEventHandler<HTMLDivElement>
radiusstring
sizeIconButtonSizessmall
tooltipReactNode
tooltipPropsOmit<TooltipProps, "title" | "children">
uncollapsedVariantSidebarVariantswhite
variantIconButtonVariantsoutlined
wrapperPropsHTMLAttributes<HTMLDivElement> & { as?: any; ref?: HTMLDivElement; }
SkipNav
Prop nameTypeDefaultDescription
asvoid | WebTarget
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
forwardedAsvoid | WebTarget
themeDefaultTheme
    Example
    Example
    Basic Usage
    Basic Usage
    Sidebar Variants
    Sidebar Variants
    Navbar Variants
    Navbar Variants
    Logo Variants
    Logo Variants
    Scrolling content
    Scrolling content
    Different Structure
    Different Structure
    Keyboard navigation with SkipNav
    Keyboard navigation with SkipNav
    Disabling individual SkipNav
    Disabling individual SkipNav
    References
    References
    API
    API
    Layout
    Layout
    Logo
    Logo
    Main
    Main
    Navbar
    Navbar
    Sidebar
    Sidebar
    SidebarCollapse
    SidebarCollapse
    SkipNav
    SkipNav
Coral is a thoroughly developed design system widely adopted by developers and designers for creating beautiful and user-friendly Sea internal products.

Copyright © 2018-2025 Sea Labs