Tabs and page navigation

Several labels in a row can mean very different things. Tabs replace the visible panel, a section index moves through an existing document, and page links open separate destinations. Choose the behavior first, then make the active state and keyboard route match that choice.

Original catalog components. Changes affect this example only.

Interactive demo. No data is sent.

Decide what changes when a label is selected

Ask whether the person stays in the same interface, moves to content already present, or opens another page. A project panel with Overview, Activity, and Files can use tabs. A long article can use section links. A documentation category with its own address needs navigation that behaves like a destination people can bookmark or share.

Similar rounded labels can hide these differences visually. Give each pattern the semantics and behavior it actually needs. Do not use a tab role just to obtain a selected appearance. In particular, a language link that opens a translated page and a tab that swaps local content are different navigation decisions.

Use tabs for related panels

The project-tabs example switches between three local sample sections. Its visible panel changes along with the selected tab, and the panel is associated with the active label. Try selecting each option and moving into its content. These are sample project details; the Files panel does not load or manage your actual documents.

Keep the active tab obvious after the pointer leaves. If panel content takes time to load in an application, choose an activation model that avoids repeatedly starting work as keyboard focus passes through labels. The shipped example has immediate local content. Its responsiveness does not establish the loading behavior of a connected account or remote dataset.

Use an index for content that remains on the page

The section-index example contains a small scrollable article inside the component. Intro, Design, and Motion move through that internal region, and scrolling updates its current marker. Try scrolling manually after selecting a section. The index and the reading position should stay connected rather than showing two conflicting locations.

This example does not navigate the browser to separate pages or change the main article’s URL. For a real document index, ordinary links to section IDs can provide meaningful destinations. Leave room above headings when the site has a fixed header, and make sure a copied section link opens at an understandable reading position.

html
<nav aria-label="Article sections">
  <a href="#design">Design</a>
  <a href="#motion">Motion</a>
</nav>
<section id="design"><h2>Design</h2></section>

Check selection and focus as separate signals

The sample tabs use left and right arrows to change the active tab, with Home and End reaching the first and last options. Only the current tab participates in the tab group’s sequential focus route. Test entering the group, changing panels, and moving onward into the content so focus never seems to disappear.

The section index uses its own controls and marks the current reading location. Its animation follows selection, while reduced motion uses an immediate scroll. Try reversing direction and interrupting a programmatic scroll with manual input. A decorative marker should follow the actual state; it should never become the only clue to where the person is reading.

Keep destinations and application state explicit

In your application, decide which view belongs in the URL and how browser Back should behave. That decision is separate from styling the tab indicator. Use actual links for actual destinations, and provide a sensible initial view when someone opens a shared address. Avoid restoring a stale local choice over the destination that the person explicitly requested.

The SL UI Library examples change local sample content and reading position. Take the complete package, retain its controller and styles with React or Next.js entries, and connect any routing yourself. Review long labels, narrow widths, keyboard order, selected contrast, interrupted movement, and reduced motion before publishing the integrated page.

Reference documentation

Technical documentation behind these examples. You can use the article without opening these links.

More practical guides

Button states: hover, focus, loading, success, and errorDesign clear button states with an interactive example, keyboard focus, loading feedback, and practical HTML, CSS, and JavaScript guidance.Animated buttons with HTML, CSS, and JavaScriptBuild purposeful button animation with CSS transitions, clear interaction states, reversible motion, and a reduced-motion alternative.