Home / Function/ SidebarRail() — ui Function Reference

SidebarRail() — ui Function Reference

Architecture documentation for the SidebarRail() function in sidebar.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  f3b4c2a0_e31a_ff53_9d9f_c82a06bd03da["SidebarRail()"]
  403a7802_5284_b88e_6793_ca6286c4d07c["sidebar.tsx"]
  f3b4c2a0_e31a_ff53_9d9f_c82a06bd03da -->|defined in| 403a7802_5284_b88e_6793_ca6286c4d07c
  1f9f6fed_bfb5_58df_017b_cc77688dfff3["useSidebar()"]
  f3b4c2a0_e31a_ff53_9d9f_c82a06bd03da -->|calls| 1f9f6fed_bfb5_58df_017b_cc77688dfff3
  style f3b4c2a0_e31a_ff53_9d9f_c82a06bd03da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/examples/radix/ui-rtl/sidebar.tsx lines 278–301

function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
  const { toggleSidebar } = useSidebar()

  return (
    <button
      data-sidebar="rail"
      data-slot="sidebar-rail"
      aria-label="Toggle Sidebar"
      tabIndex={-1}
      onClick={toggleSidebar}
      title="Toggle Sidebar"
      className={cn(
        "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
        "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize rtl:in-data-[side=left]:cursor-e-resize rtl:in-data-[side=right]:cursor-w-resize",
        "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize rtl:[[data-side=left][data-state=collapsed]_&]:cursor-w-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize rtl:[[data-side=right][data-state=collapsed]_&]:cursor-e-resize",
        "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:start-full rtl:group-data-[collapsible=offcanvas]:-translate-x-0",
        "[[data-side=left][data-collapsible=offcanvas]_&]:-end-2",
        "[[data-side=right][data-collapsible=offcanvas]_&]:-start-2",
        className
      )}
      {...props}
    />
  )
}

Subdomains

Calls

Frequently Asked Questions

What does SidebarRail() do?
SidebarRail() is a function in the ui codebase, defined in apps/v4/examples/radix/ui-rtl/sidebar.tsx.
Where is SidebarRail() defined?
SidebarRail() is defined in apps/v4/examples/radix/ui-rtl/sidebar.tsx at line 278.
What does SidebarRail() call?
SidebarRail() calls 1 function(s): useSidebar.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free