use-layout.tsx — ui Source File
Architecture documentation for use-layout.tsx, a tsx file in the ui codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5b8512fa_600d_78c3_a5b4_d8c8a67b2771["use-layout.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 5b8512fa_600d_78c3_a5b4_d8c8a67b2771 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 style 5b8512fa_600d_78c3_a5b4_d8c8a67b2771 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
type Layout = "fixed" | "full"
interface LayoutProviderProps {
children: React.ReactNode
defaultLayout?: Layout
forcedLayout?: Layout
storageKey?: string
attribute?: string | string[]
value?: Record<string, string>
}
interface LayoutProviderState {
layout: Layout
setLayout: (layout: Layout | ((prev: Layout) => Layout)) => void
forcedLayout?: Layout
}
const isServer = typeof window === "undefined"
const LayoutContext = React.createContext<LayoutProviderState | undefined>(
undefined
)
const saveToLS = (storageKey: string, value: string) => {
try {
localStorage.setItem(storageKey, value)
} catch {
// Unsupported
}
}
const useLayout = () => {
const context = React.useContext(LayoutContext)
if (context === undefined) {
throw new Error("useLayout must be used within a LayoutProvider")
}
return context
}
const Layout = ({
forcedLayout,
storageKey = "layout",
defaultLayout = "full",
attribute = "class",
value,
children,
}: LayoutProviderProps) => {
const [layout, setLayoutState] = React.useState<Layout>(() => {
if (isServer) return defaultLayout
try {
const saved = localStorage.getItem(storageKey)
if (saved === "fixed" || saved === "full") {
return saved
}
return defaultLayout
} catch {
return defaultLayout
// ... (104 more lines)
Domain
Subdomains
Dependencies
- react
Source
Frequently Asked Questions
What does use-layout.tsx do?
use-layout.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, SearchAPI subdomain.
What functions are defined in use-layout.tsx?
use-layout.tsx defines 5 function(s): Layout, LayoutProvider, layout, saveToLS, useLayout.
What does use-layout.tsx depend on?
use-layout.tsx imports 1 module(s): react.
Where is use-layout.tsx in the architecture?
use-layout.tsx is located at apps/v4/hooks/use-layout.tsx (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/hooks).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free