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"
function App() {
return (
<Lucent config={{}}>
<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"
function MyComponent() {
const layout = useLayout()
// Access current modes
console.log(layout.modes.theme) // 'light' | 'dark'
console.log(layout.modes.sidebar) // 'base' | 'hidden' | 'collapsed'
// Toggle modes
layout.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:
const config = {
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:
const defaultParams = {
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:
const layout = 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"
function App() {
return (
<Lucent config={{}}>
<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"
function App() {
const config = {
modes: {
theme: "dark",
sidebar: "collapsed",
infobar: "base"
},
params: {
headerHeight: "4rem",
sidebarWidth: "280px",
sidebarCollapsedWidth: "70px",
infobarWidth: "320px",
transitionDuration: "0.3s"
}
}
return (
<Lucent config={config}>
<Lucent.Header>
<div className="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>
)
}
function ThemeToggle() {
const layout = useLayout()
return <button onClick={layout.toggleThemeMode}>{layout.isThemeDark ? "βοΈ" : "π"}</button>
}import { Lucent } from "@scottwalker/lucent"
function App() {
return (
<Lucent config={{}}>
<Lucent.Header>
<LayoutControls />
</Lucent.Header>
<Lucent.Sidebar>
<SidebarContent />
</Lucent.Sidebar>
<Lucent.Body>
<MainContent />
</Lucent.Body>
<Lucent.Infobar>
<InfoPanel />
</Lucent.Infobar>
</Lucent>
)
}
function LayoutControls() {
const layout = useLayout()
return (
<div className="controls">
<button onClick={layout.toggleSidebarCollapsedMode}>
{layout.isSidebarCollapsed ? "Expand" : "Collapse"} Sidebar
</button>
<button onClick={layout.toggleInfobarCollapsedMode}>
{layout.isInfobarCollapsed ? "Expand" : "Collapse"} Infobar
</button>
<button onClick={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 π).
