Just a layout system for React (with full TypeScript support) that can be the foundation for any custom layout... well, that's basically it (for now).
- ✅ Flexible Layout Management - Control visibility and collapse states of all layout components
- ✅ Theme Support - Built-in light/dark theme switching
⚠️ Responsive Design - Responsive design is still in development! 🙃😇- ✅ TypeScript First - Full TypeScript support with comprehensive type definitions
- ✅ Zero Dependencies - No external dependencies, just React
- ✅ Highly Configurable - Customizable dimensions for layout element states
- ✅ Context API - Easy state management and component communication
npm install @scottwalker/lucentimport{Lucent}from"@scottwalker/lucent"functionApp(){return(<Lucentconfig={{}}><Lucent.Header>Header Content</Lucent.Header><Lucent.Sidebar>Sidebar Content</Lucent.Sidebar><Lucent.Body>Main Content</Lucent.Body><Lucent.Infobar>Info Panel</Lucent.Infobar><Lucent.Footer>Footer Content</Lucent.Footer></Lucent>)}📦 Lucent/
├── 📁 src/ # Main library source
│ ├── index.ts # Main entry point & exports
│ │
│ ├── 📁 lib/ # Core utilities & constants
│ │ ├── constants.ts # Layout mode constants
│ │ ├── context.ts # React context & useLayout hook
│ │ └── utils.ts # Utility functions & normalization
│ │
│ ├── 📁 types/ # TypeScript type definitions
│ │ └── index.ts # All layout types & interfaces
│ │
│ ├── 📁 structure/ # Core layout structure
│ │ ├── provider.tsx # Main LayoutProvider component
│ │ └── index.ts # Structure exports
│ │
│ ├── 📁 ui/ # Layout UI components
│ │ ├── container.tsx # Main layout container
│ │ ├── header.tsx # Header component
│ │ ├── sidebar.tsx # Sidebar component
│ │ ├── body.tsx # Main content area
│ │ ├── infobar.tsx # Info panel component (right side)
│ │ ├── footer.tsx # Footer component
│ │ └── index.ts # UI exports
│ │
│ └── 📁 style/ # Styling
│ └── layout.module.css # CSS modules for layout
│
└── 📁 demo/ # Demo application (very raw for now, but it works... hehe 😁)
Lucent is built around a central layout provider that manages the state and behavior of all layout components:
Lucent- Main layout provider componentLucentHeader- Header componentLucentSidebar- Sidebar componentLucentBody- Main content areaLucentInfobar- Right infobar componentLucentFooter- Footer component
The layout system uses React Context to provide a centralized API for managing layout state:
import{useLayout}from"@scottwalker/lucent"functionMyComponent(){constlayout=useLayout()// Access current modesconsole.log(layout.modes.theme)// 'light' | 'dark'console.log(layout.modes.sidebar)// 'base' | 'hidden' | 'collapsed'// Toggle modeslayout.toggleThemeMode()layout.toggleSidebarCollapsedMode()}Each layout component can be in different modes (expanded, collapsed, or hidden). The layout itself can be in light or dark mode (basic theming):
light- Light themedark- Dark theme
base- Visible headerhidden- Hidden header
base- Visible footerhidden- Hidden footer
base- Fully expanded sidebarcollapsed- Collapsed sidebarhidden- Hidden sidebar
base- Fully expanded infobarcollapsed- Collapsed infobarhidden- Hidden infobar
Layout appearance settings:
constconfig={modes: {theme: "dark",sidebar: "collapsed",infobar: "hidden"},params: {headerHeight: "4rem",footerHeight: "3rem",sidebarWidth: "250px",sidebarCollapsedWidth: "60px",infobarWidth: "300px",infobarCollapsedWidth: "60px",transitionDuration: "0.2s"}}If not specified, the following defaults are used:
constdefaultParams={headerHeight: "3.125rem",footerHeight: "3.125rem",sidebarWidth: "15.625rem",sidebarCollapsedWidth: "3.125rem",infobarWidth: "15.625rem",infobarCollapsedWidth: "3.125rem",transitionDuration: "0.15s"}The useLayout hook provides access to the layout API:
constlayout=useLayout()modes- Current layout modesparams- Current layout parameters
isThemeDark- Check if dark theme is activeisHeaderHidden- Check if header is hiddenisFooterHidden- Check if footer is hiddenisSidebarHidden- Check if sidebar is hiddenisSidebarCollapsed- Check if sidebar is collapsedisInfobarHidden- Check if infobar is hiddenisInfobarCollapsed- Check if infobar is collapsed
setMode(mode, value)- Set a specific modesetParams(params)- Update multiple parameterssetParam(name, value)- Update a single parameter
toggleThemeMode()- Switch between light/dark themestoggleHeaderVisibleMode()- Show/hide headertoggleFooterVisibleMode()- Show/hide footertoggleSidebarVisibleMode()- Show/hide sidebartoggleSidebarCollapsedMode()- Expand/collapse sidebartoggleInfobarVisibleMode()- Show/hide infobartoggleInfobarCollapsedMode()- Expand/collapse infobar
import{Lucent}from"@scottwalker/lucent"functionApp(){return(<Lucentconfig={{}}><Lucent.Header><h1>Company for Delivering Troubles</h1></Lucent.Header><Lucent.Sidebar><nav><ul><li>Dashboard</li><li>Users</li><li>Settings</li></ul></nav></Lucent.Sidebar><Lucent.Body><div><h2>Welcome to your dashboard</h2><p>This is the main content area.</p></div></Lucent.Body><Lucent.Infobar><div><h3>Quick Info</h3><p>Additional information panel</p></div></Lucent.Infobar><Lucent.Footer><p>© 2025 Company for Delivering Troubles</p></Lucent.Footer></Lucent>)}import{Lucent}from"@scottwalker/lucent"functionApp(){constconfig={modes: {theme: "dark",sidebar: "collapsed",infobar: "base"},params: {headerHeight: "4rem",sidebarWidth: "280px",sidebarCollapsedWidth: "70px",infobarWidth: "320px",transitionDuration: "0.3s"}}return(<Lucentconfig={config}><Lucent.Header><divclassName="header-content"><h1>Advanced App</h1><ThemeToggle/></div></Lucent.Header><Lucent.Sidebar><Navigation/></Lucent.Sidebar><Lucent.Body><MainContent/></Lucent.Body><Lucent.Infobar><InfoPanel/></Lucent.Infobar></Lucent>)}functionThemeToggle(){constlayout=useLayout()return<buttononClick={layout.toggleThemeMode}>{layout.isThemeDark ? "☀️" : "🌙"}</button>}import{Lucent}from"@scottwalker/lucent"functionApp(){return(<Lucentconfig={{}}><Lucent.Header><LayoutControls/></Lucent.Header><Lucent.Sidebar><SidebarContent/></Lucent.Sidebar><Lucent.Body><MainContent/></Lucent.Body><Lucent.Infobar><InfoPanel/></Lucent.Infobar></Lucent>)}functionLayoutControls(){constlayout=useLayout()return(<divclassName="controls"><buttononClick={layout.toggleSidebarCollapsedMode}>{layout.isSidebarCollapsed ? "Expand" : "Collapse"} Sidebar
</button><buttononClick={layout.toggleInfobarCollapsedMode}>{layout.isInfobarCollapsed ? "Expand" : "Collapse"} Infobar
</button><buttononClick={layout.toggleThemeMode}>{layout.isThemeDark ? "Light" : "Dark"} Theme</button></div>)}Lucent uses CSS custom properties and specific layout mode attributes for styling. You can override these in your CSS:
/* Custom theme colors */
[data-theme-mode="light"] {
--ll-bg-primary:#ffffff;
--ll-text-primary:#000000;
}
[data-theme-mode="dark"] {
--ll-bg-primary:#1a1a1a;
--ll-text-primary:#ffffff;
}
/* Custom dimensions */
[data-sidebar-mode="base"] {
--ll-sidebar-width:300px;
}
[data-sidebar-mode="collapsed"] {
--ll-sidebar-width:80px;
}- React 18+
- Browsers with CSS Grid support
- TypeScript 4.5+
MIT License - see LICENSE file for super details (which nobody reads... including me 😇).
