UNPKG

@atlaskit/navigation-system

Version:

Page layout and navigation components for Atlassian apps.

254 lines (198 loc) • 9.96 kB
--- title: Layout description: Layout components define a page’s structure and the areas for navigation and content. order: 4 --- import Image from '@atlaskit/image'; import layoutAnatomyLight from './images/layout-anatomy-light.png'; import layoutAnatomyDark from './images/layout-anatomy-dark.png'; import behaviourResizingLight from './images/behaviour-resizing-light.png'; import behaviourResizingDark from './images/behaviour-resizing-dark.png'; import behaviourViewportSizeLight from './images/behaviour-viewport-size-light.png'; import behaviourViewportSizeDark from './images/behaviour-viewport-size-dark.png'; import behaviourPanelOverlayLight from './images/behaviour-panel-overlay-light.png'; import behaviourPanelOverlayDark from './images/behaviour-panel-overlay-dark.png'; import behaviourOverlayLight from './images/behaviour-overlay-light.png'; import behaviourOverlayDark from './images/behaviour-overlay-dark.png'; import reflowDoLight from './images/reflow-do-light.png'; import reflowDoDark from './images/reflow-do-dark.png'; import reflowDontLight from './images/reflow-dont-light.png'; import reflowDontDark from './images/reflow-dont-dark.png'; import layoutDoLight from './images/layout-do-light.png'; import layoutDoDark from './images/layout-do-dark.png'; import layoutDontLight from './images/layout-dont-light.png'; import layoutDontDark from './images/layout-dont-dark.png'; ## Usage Layout provides a consistent structure for navigation and content across Atlassian apps. It manages page behavior across viewport sizes, including when users open, close, or resize layout areas. ## Parts <Image src={layoutAnatomyLight} srcDark={layoutAnatomyDark} alt="Diagram of the navigation system layout areas" /> Layout contains the following areas: 1. **Banner (optional):** Use to display a [banner](/components/banner/usage). 2. **Top nav:** Use to display [top nav items](/components/navigation-system/top-nav-items/usage). 3. **Side nav:** Use to display [side nav items](https://atlaskit.atlassian.com/packages/navigation/side-nav-items). 4. **Main:** Use for the [page header](/components/page-header/examples) and content. 5. **Panel (optional):** Use to display a [panel](/components/panel/usage). 6. **Chat panel (optional):** Use to display Rovo Chat. ## Behavior Side nav, panel, and chat panel can be opened, closed, and resized. Layout adjusts the widths of open areas to fit the available space, using overlays when the areas can’t fit side by side. See the [examples tab](/components/navigation-system/layout/examples) for width settings and detailed resizing behavior, or explore the [interactive example](https://atlaskit.stg.atlassian.com/examples/navigation/global-top-navigation/self-hiding-chat). ### Opening and closing layout areas - **Side nav:** Expands or collapses using the toggle button in top nav. - **Panel:** Opens in response to an action in the app, such as selecting an item or button, and closes using its close button. See [panel](/components/panel/usage) for guidance. - **Chat panel:** Opens through Rovo Chat triggers, such as **Ask Rovo** in top nav, and closes using the close button within Rovo Chat. ### Resizing layout areas Side nav, panel, and chat panel can be resized by dragging their resize handles. Other layout areas adjust automatically within their width limits. Resizing doesn’t cause areas to collapse or become overlays. Main isn’t directly resizable and fills the remaining space. Each resizable area retains its chosen width when closed and reopened. Apps can control whether widths are also preserved across page navigation and refreshes. <Image src={behaviourResizingLight} srcDark={behaviourResizingDark} alt="Two layouts showing a chat panel at its default width, then widened by dragging its resize handle while main and panel become narrower." /> ### Layout areas adapt to viewport size Side nav, panel, and chat panel appear at their default widths, or the widths people have resized them to, when the viewport is wide enough. When there isn’t enough room, layout areas become narrower to stay side by side, down to their minimum widths. <Image src={behaviourViewportSizeLight} srcDark={behaviourViewportSizeDark} alt="Two layouts showing open areas at wider viewport widths, then becoming narrower together as the viewport shrinks." /> ### Layout areas overlay when they no longer fit side by side Panel and chat panel become overlays when the viewport isn’t wide enough for the open areas to fit side by side at their minimum widths. Panel overlays main first. If main and chat panel still can’t fit side by side at their minimum widths, chat panel overlays the rest of the app. <Image src={behaviourPanelOverlayLight} srcDark={behaviourPanelOverlayDark} alt="Panel overlaying main while side nav and chat panel remain open alongside it." /> <Image src={behaviourOverlayLight} srcDark={behaviourOverlayDark} alt="Chat panel overlaying the rest of the app when main and chat panel can no longer fit side by side." /> Side nav follows a fixed breakpoint. At viewport widths of 1,023px and below (`xxs`, `xs`, and `s` breakpoints), it collapses and opens as an overlay. Side nav and chat panel can’t both be open as overlays. Opening one closes the other. Overlays can also be resized. ## Accessibility ### Reading order The order of layout areas in the page structure determines how people move through them using a keyboard or screen reader. Follow the component structure shown in the [examples tab](/components/navigation-system/layout/examples) to preserve the intended reading and keyboard navigation order. ### Landmarks and accessible names Landmarks identify major page areas so screen reader users can navigate between them. Layout automatically provides landmark roles for top nav, side nav, main, panel, and chat panel. Don’t add another landmark role to identify the same layout area. Side nav, panel, and chat panel have the default accessible names **Sidebar**, **Panel**, and **Chat panel**. Screen readers announce these names to identify the areas. Give panel a meaningful name based on its content, such as **Project details**. When customizing an accessible name, describe the area’s purpose without repeating its landmark role. For headings, header-action labels, and focus behavior within a panel, follow the [panel accessibility guidance](/components/panel/usage#accessibility). ### Keyboard resizing People can use **Tab** to focus a resize handle, then use: - **Right arrow**, **Up arrow**, or **Page Up** to make the area wider. - **Left arrow**, **Down arrow**, or **Page Down** to make the area narrower. - **Home** to set the minimum width. - **End** to set the maximum available width. ### Skip links Layout provides skip links that let keyboard users move directly to page areas. Skip links for panel and chat panel are available when those areas are open. The panel’s accessible name is also used for its skip link unless a separate skip-link label is supplied. Use the skip links provided by layout. Avoid adding custom skip links. ### Content reflow When people zoom in, less content fits within the browser window. At 400% zoom, a viewport that started at 1,280px wide at 100% zoom has an effective width of 320px. Main, panel, and chat panel have 320px minimum widths to support [WCAG reflow requirements](https://www.w3.org/WAI/WCAG21/Understanding/reflow.html). Design content to adapt to these, then test the page at 400% browser zoom to confirm information and actions remain available and usable without horizontal scrolling. Content that requires a two-dimensional layout, such as data tables and maps, is an exception. <DoDontGrid> <DoDont type="do" image={{ url: reflowDoLight, urlDarkMode: reflowDoDark, alt: 'A narrow viewport with content that reflows vertically so information and actions remain usable.', }} > Design content to fit within 320px, keeping information available and actions usable at 400% zoom. </DoDont> <DoDont type="dont" image={{ url: reflowDontLight, urlDarkMode: reflowDontDark, alt: 'A narrow viewport where content requires horizontal scrolling to reach information and actions.', }} > Don’t rely on horizontal scrolling to make content fit. It makes text harder to follow. </DoDont> </DoDontGrid> ## Best practices ### Use the supplied width settings <DoDontGrid> <DoDont type="do"> Use the supplied default, minimum, and maximum widths where possible (see the{' '} <a href="/components/navigation-system/layout/examples">examples tab</a> for values). These settings are designed to work together across viewport sizes and as people open, close, or resize layout areas. </DoDont> <DoDont type="dont"> Don’t override width settings without checking the effect on the whole layout. Check different viewport sizes, combinations of open areas, user resizing, and accessibility. </DoDont> </DoDontGrid> ### Design using grid in the main area <DoDontGrid> <DoDont type="do" image={{ url: layoutDoLight, urlDarkMode: layoutDoDark, alt: 'A layout with a grid overlay on the Main area.', }} isFullWidth > When designing, use <a href="/foundations/grid">grid</a> to position content within the main area only. </DoDont> <DoDont type="dont" image={{ url: layoutDontLight, urlDarkMode: layoutDontDark, alt: 'A layout with a grid overlay extending across side nav, main, panel, and chat panel.', }} isFullWidth > Don’t include side nav, panel, or chat panel areas as part of your{' '} <a href="/foundations/grid">grid</a>. </DoDont> </DoDontGrid> ## Related - [Page header](/components/page-header/examples) - [Top nav items](/components/navigation-system/top-nav-items/usage) - [Side nav items](https://atlaskit.atlassian.com/packages/navigation/side-nav-items) - [Panel](/components/panel/usage)