Tesserae

Pivot

Description

The Pivot component is a tab-based container used to organize and display content panels within a user interface. It allows users to switch between different views or sections by clicking on tab titles, with options to customize tab alignment (normal, justified, or centered) and to control caching of tab content. Use it when you need to present segmented information in a compact, navigable format.

Usage

Instantiate the Pivot component using the static helper method from the Tesserae.UI static class. Add tabs by chaining the .Pivot() method with a unique tab identifier, a title generated with PivotTitle(), and a function that returns the tab content. The Pivot component is designed to be highly configurable with additional style methods for layout management.

Below is a simple usage example:

Methods

  • Justified()
    Returns: Pivot
    Description: Adjusts the tab title bar's layout so that the tabs are evenly distributed across the available width.

  • Centered()
    Returns: Pivot
    Description: Centers the tab titles within the tab title bar.

  • HideIfSingle()
    Returns: Pivot
    Description: Hides the tab header if there is only one tab, reducing visual clutter.

  • RefreshPivotSizes()
    Returns: void
    Description: Recalculates the layout and sizing of tabs, including handling overflow of tab titles.

  • OnBeforeNavigate(PivotEventHandler onBeforeNavigate)
    Returns: Pivot
    Parameter: onBeforeNavigate – A delegate that handles the event before a tab navigation occurs. You can cancel the navigation by invoking Cancel() on the event argument.

  • OnNavigate(PivotEventHandler onNavigate)
    Returns: Pivot
    Parameter: onNavigate – A delegate that is invoked after a tab has been navigated to.

  • Select(string id, bool refresh = false)
    Returns: Pivot
    Parameters:
    • id – The unique identifier of the tab to select.
    • refresh (optional) – If true, forces a refresh even if the tab is currently selected. Description: Programmatically selects a tab by its identifier.

  • Render()
    Returns: HTMLElement
    Description: Renders the Pivot component including the title bar, the animated line indicator, and the currently selected tab content. This is the entry point for integrating the component into the document.

Properties

  • SelectedTab (string)
    Description: Gets the unique identifier of the currently selected tab.

  • StylingContainer (HTMLElement)
    Description: The primary container element that holds all parts of the Pivot component (tabs, line indicator, and content area).

  • PropagateToStackItemParent (bool)
    Description: Indicates whether the styling should propagate to the parent container when the Pivot is nested inside a stack.

Samples

Basic Pivot Usage Sample

This sample demonstrates creating a basic Pivot with three tabs. It sets up the Pivot, adds tabs with simple text content, applies centered tab alignment, and renders the component to the document body.

Advanced Usage: Cached vs. Not Cached Tabs

This sample shows how to configure tabs with caching options. Cached tabs store their content after the initial render to improve performance, while non-cached tabs re-render their content every time they are selected.

See also

© 2026 Tesserae. All rights reserved.