Skip to content
SkillCodex
Menu

Sidebar

Sidebar

A persistent region beside primary content that participates in page layout and usually contains navigation or supporting tools.

Try the component
Context, sources and actions
Sources and revision
Updated
Version
v1.0.26 · r2
Sources
5 sources
Status
Published
Read the sources

You may have searched for: navigation that stays on the lefta permanent column beside the pagekeep project sections visible while I work

All phrasings
Save and share

Recognize

Edge-attached surfaces

Try it

Should the surface stay persistent, enter from a side edge, or rise from the bottom?

Sidebar

Shared trial context

A workspace places supporting navigation or controls along a screen edge while the main task stays in context.

Sidebar

Mission

Sidebar

Choose Chairs in the persistent category navigation, collapse the sidebar, and verify the furniture results reflow without losing focus.

All furniture

All office furniture results are displayed.

12 results

Office furniture

  • Compact desk

    In stock

  • Adjustable chair

    Made to order

Live result

The sidebar filters are expanded beside the results without blocking them. All office furniture results are displayed.

Step 1 of 3

Try

Try the component. Your live result appears just above. Move on at your own pace.

Behavior and edge case
What to observe
The persistent category navigation occupies stable layout width beside the same furniture list, marks the current category, and never makes results inert.
Edge case
When the product-defined layout no longer has room, a separately named menu can open temporary category navigation for the same results.

What this example shows

Sidebar remains in layout and does not trap focus; Drawer and Bottom sheet are temporary surfaces that may make the page inert.

Which fits your need?

Sidebar

Navigating stable sections of a desktop workspace

Drawer

Editing filters without leaving results

Which component will you use here?
Difference and sources

Sidebar remains in layout and does not trap focus; Drawer and Bottom sheet are temporary surfaces that may make the page inert.

Read the sources

    Parts of the specimen

    Select a numbered marker on the schematic, or use the list below, to see its role. The schematic shows the concept's representative state.

    Surface

    The visible container that holds the concept's content.

    Position in the atlas

    Relationship map

    Locate the chapter, neighboring concepts, and the next useful decision.

    • Chapter

      Edge-attached surfaces

      Sidebar belongs to this comparison group.

    • Do not confuse

      Drawer

      Choose Sidebar if the region must stay in place for navigation or persistent tools. Choose Drawer if the panel opens for a focused task and then closes, such as filters or a detail view.

      Compare this pair
    • Do not confuse

      Bottom sheet

      Choose Sidebar if navigation must stay visible and persistent in the workspace. Choose Bottom sheet if the surface appears for a one-off task, especially on mobile, then goes away.

      Compare this pair
    • Next step

      Compare the concepts in the chapter before choosing an implementation.

      Open the chapter

    In your own words

    Understand

    What people describe

    Documented aliases: side navigation, navigation rail, aside, side panel

    • navigation that stays on the left
    • a permanent column beside the page
    • keep project sections visible while I work
    • a side menu that moves content instead of covering it
    • desktop navigation in a narrow left rail
    • a fixed area for folders and shortcuts

    Choose

    Use it when

    • Navigating stable sections of a desktop workspace
    • Keeping folders or filters visible during repeated work

    Avoid it when

    • The surface is needed only briefly
    • The remaining content becomes too narrow or horizontally scrolls

    Compare

    Compare similar concepts

    Verification checklist

    Try these actions in the lab, then check the same behaviours in your agent’s result. Adapt the example names to your interface.

    1. 1. Do this

      Choose another section in the sidebar, then read the main area.

      Expected result

      The selected location is identifiable, the main content matches it, and the sidebar remains part of the page layout.

    2. 2. Do this

      Use Tab from the sidebar into the main content, then collapse the sidebar if that option exists.

      Expected result

      Focus can leave the sidebar normally; collapsing it preserves usable navigation and does not create a modal focus trap.

    3. 3. Do this

      Reduce the window to a phone width and open the available navigation.

      Expected result

      The active location remains clear. If navigation becomes a temporary drawer, it has an explicit opening and closing path.

    Full contract
    1. 1The sidebar occupies layout space rather than overlaying content
    2. 2Its navigation region has a unique name
    3. 3Current location and collapsed state are exposed
    4. 4The narrow-screen replacement is an explicit separate pattern

    Understand → Recognize → Choose → Compare

    Pack for your agent

    Pre-written instructions to paste into your agent. Copying executes nothing.

    Implement correctly

    Build Sidebar without breaking its behavior

    # Implement Sidebar in your agent
    
    ## Objective
    Implement Sidebar for this verified behavior: A persistent region beside primary content that participates in page layout and usually contains navigation or supporting tools.
    
    ## Prerequisites
    - Inspect the repository, design system, and existing tests first.
    - Preserve unrelated changes and keep the file scope bounded.
    - Confirm that Sidebar matches the need before writing code.
    
    ## Required behavior
    - The region occupies page layout space instead of temporarily covering primary content.
    - If the product replaces the persistent region when space is insufficient, the replacement is a separately named temporary navigation control.
    
    ## States to cover
    - Sidebar expanded
    - Sidebar compact
    
    ## Accessibility
    - ARIA role: aside > nav[aria-label]
    - The primary control or named region for Sidebar has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    - Focus moves normally between the sidebar and main content; collapse preserves a logical focused control.
    - A persistent sidebar is collapsed, not dismissed; any temporary mobile counterpart follows its own Drawer dismissal contract.
    - The navigation region has a unique name and the current destination uses aria-current when appropriate.
    - Tab follows normal document order
    - Enter activates links and collapse controls
    - No focus trap is created
    
    ## When not to use
    - The surface is needed only briefly
    - The remaining content becomes too narrow or horizontally scrolls
    
    ## Acceptance criteria
    - The sidebar occupies layout space rather than overlaying content
    - Its navigation region has a unique name
    - Current location and collapsed state are exposed
    - The narrow-screen replacement is an explicit separate pattern
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The need is tied to canonical behavior before any technical choice.
    • States, accessibility, and non-goals prevent a merely visual implementation.
    • Acceptance criteria and the output format make verification observable.

    Try next

    Verify Sidebar on a real journey

    # Verify Sidebar after implementation
    
    ## Objective
    Audit the Sidebar implementation against its behavior, states, and accessibility requirements without changing it automatically.
    
    ## Checks
    - Replay the smallest representative journey.
    - Check keyboard behavior, focus, accessible name, and announcements.
    - Tie each gap to a specific acceptance criterion.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:e79bcf73c9929f2f62cc2d5531a2d89325301e5e6c0bdc17b57fad53dff0dc30

    Diagnose a problem

    Find and fix the Sidebar defect

    # Debug Sidebar in your agent
    
    ## Observed symptom
    [DESCRIBE THE SYMPTOM HERE]
    
    ## Observable checks
    - Reproduce the issue with the smallest relevant journey.
    - Compare behavior with the documented states and transitions for Sidebar.
    - Verify keyboard behavior, focus, accessible name, and announcements.
    
    ## Possible causes
    - The chosen primitive does not match the expected behavior.
    - A state, transition, or focus return is missing.
    - A neighboring component captures an event or hides an accessible signal.
    
    ## Bounded corrections
    - Fix the reproduced cause without recreating neighboring components.
    - Preserve the public contract and add a focused regression test.
    - Do not install dependencies or change remote state without authorization.
    
    ## Final verification
    - The sidebar occupies layout space rather than overlaying content
    - Its navigation region has a unique name
    - Current location and collapsed state are exposed
    - The narrow-screen replacement is an explicit separate pattern
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The explicit symptom prevents starting from an assumed fix.
    • Checks separate behavior, accessibility, and neighboring interference.
    • The fix stays bounded and must produce regression evidence.

    Try next

    Lock in the Sidebar fix

    # Prevent the Sidebar regression
    
    ## Objective
    Turn the reproduced cause into a focused regression test and compare Sidebar with neighboring concepts before widening the fix.
    
    ## Checks
    - Prove that the test fails before the fix.
    - Prove that it passes after the bounded fix.
    - Verify that no neighboring component changed behavior.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:d6703f4f1a24f2e14bdc89403787f5c20f001ed0bfbc4c82641334675c20e885

    Full entry, saving and provenance

    Pre-written instruction by SkillCodex — your request is neither sent nor used to adapt this text; no content is generated, and copying executes nothing.

    Pack digest: sha256:b7500a9e43325e4db0c551a622f97b0ad8c88defb281724f161b0205ac0bd612

    In code

    TechnologyPrimitiveVersionCaveat
    Web platform

    aside with nav

    NativeA persistent sidebar is layout and navigation, not a modal dialog. A temporary mobile counterpart needs separate drawer behavior.

    Technical details

    Behaviors

    • Remain in layout

      The region occupies page layout space instead of temporarily covering primary content.

    • Adapt at narrow widths

      If the product replaces the persistent region when space is insufficient, the replacement is a separately named temporary navigation control.

    States

    • Sidebar expanded

      Sidebar expanded

    • Sidebar compact

      Sidebar compact

    State transitions

    • Sidebar expanded → Sidebar compact

      The collapse control is activated while the persistent sidebar is expanded.

    • Sidebar compact → Sidebar expanded

      The expand control is activated while the persistent sidebar is compact.

    Test scenarios

    Context
    An office-furniture results page shows the same Compact desk and Adjustable chair list while people filter availability and navigate categories without leaving the results.
    Mission
    Choose Chairs in the persistent category navigation, collapse the sidebar, and verify the furniture results reflow without losing focus.
    Primary state
    The persistent category navigation occupies stable layout width beside the same furniture list, marks the current category, and never makes results inert.
    Edge case
    When the product-defined layout no longer has room, a separately named menu can open temporary category navigation for the same results.

    Visual signals

    • Vertical region beside main content
    • Occupies layout width
    • Navigation items remain visible across related views

    Behavioral signals

    • Does not create a modal backdrop
    • Main content reflows around it
    • A product may replace it with a separately named temporary pattern when layout space is insufficient

    Accessibility

    Role
    aside > nav[aria-label]
    Accessible name
    The primary control or named region for Sidebar has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    Focus
    Focus moves normally between the sidebar and main content; collapse preserves a logical focused control.
    Dismissal
    A persistent sidebar is collapsed, not dismissed; any temporary mobile counterpart follows its own Drawer dismissal contract.
    Scroll
    The document and sidebar keep independent, predictable overflow. Keyboard focus is never hidden by sticky content while the page scrolls.
    Announcement
    The navigation region has a unique name and the current destination uses aria-current when appropriate.
    Keyboard
    • Tab follows normal document order
    • Enter activates links and collapse controls
    • No focus trap is created

    Bindings

    Open the HTML, ARIA, Radix, and shadcn matrix
    • aside with nav

      implementationKind
      custom
      nativeElement
      aside with nav
      ariaPattern
      complementary or navigation region
      radixPrimitive
      Not applicable
      shadcnRecipe
      Not applicable
      runtimeDependency
      Not applicable
      packageName
      Not applicable
      exportName
      Not applicable
      exactVersion
      Not applicable
      status
      exception
      sourceId
      source-ui-wai-aria-roles
      deprecationStatus
      active
      replacement
      Not applicable
      validFrom
      Not applicable
      validUntil
      Not applicable

      Equivalence caveat: A persistent sidebar is layout and navigation, not a modal dialog. A temporary mobile counterpart needs separate drawer behavior.

      Verify binding source

    Sources

    • shadcn/ui: Sidebar
      sourceId
      source-ui-shadcn-sidebar
      kind
      documentation
      canonicalUrl
      https://ui.shadcn.com/docs/components/radix/sidebar
      publisher
      shadcn/ui
      sourceRevision
      http-etag:W/"hu4xjc7khaqc8u"
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:ea7f64d071a7663c9e4203506b341ff1a0f1b6ce869e767af29920dd8911337c
      status
      verified

      Claim covered: Sidebar: documented parts, state APIs, interaction behavior, and implementation limits for shadcn Sidebar.

    • WAI-ARIA 1.2: Roles Model
      sourceId
      source-ui-wai-aria-roles
      kind
      standard
      canonicalUrl
      https://www.w3.org/TR/wai-aria-1.2/#roles
      publisher
      W3C WAI
      sourceRevision
      W3C-REC-wai-aria-1.2-20230606
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:c0fea16fc747779569ab754d2d25bca3e2b7e8a673b8ef5362aeb9ebc73a4849
      status
      verified

      Claim covered: Sidebar: normative ARIA role definitions and constraints for the stated accessible role.

    • WCAG 2.2: Focus Appearance
      sourceId
      source-ui-wcag-understanding-focus-appearance
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-02T10:07:49Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:fdcf316a1f0e3cc758eda9618322d132862124ff0a3f3b1a3acbf20daf804ff0
      status
      verified

      Claim covered: Sidebar: informative WCAG guidance for evaluating visible keyboard focus appearance.

    • WHATWG HTML: The a element
      sourceId
      source-ui-html-link
      kind
      standard
      canonicalUrl
      https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
      publisher
      WHATWG
      sourceRevision
      http-last-modified:2026-07-19T13:52:46Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:fe0a3d4315ccdf4f171cbb0c61ee6188b0db2dfe13a7c7f1f04f6b37528661f6
      status
      verified

      Claim covered: Sidebar: normative native semantics, states, attributes, and browser behavior for a[href].

    • WHATWG HTML: The button element
      sourceId
      source-ui-html-button
      kind
      standard
      canonicalUrl
      https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element
      publisher
      WHATWG
      sourceRevision
      http-last-modified:2026-07-19T13:52:46Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:418a8f9ce1e8690c6d458121120b0b3b7cd907aa92b2101b85f82f7e02d5ac2f
      status
      verified

      Claim covered: Sidebar: normative native semantics, states, attributes, and browser behavior for button.