Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

@djangocfg/layouts

Package Overview
Dependencies
Maintainers
1
Versions
376
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@djangocfg/layouts

Simple, straightforward layout components for Next.js - import and use with props

latest
Source
npmnpm
Version
2.1.300
Version published
Weekly downloads
2.4K
37.97%
Maintainers
1
Weekly downloads
 
Created
Source

@djangocfg/layouts

@djangocfg/layouts

Layouts, app shell, and providers for Next.js App Router. Part of DjangoCFG.

pnpm add @djangocfg/layouts
/* before @import "tailwindcss" */
@import "@djangocfg/ui-nextjs/styles";
@import "@djangocfg/layouts/styles";
@import "tailwindcss";

Peers: @djangocfg/ui-core, @djangocfg/ui-nextjs, React 19, Next.js 16+, Tailwind CSS 4.

BaseApp

Root provider (theme, auth, analytics, SWR, toasts). Use when you don't need route-based layout switching.

<BaseApp
  project="my-app"
  theme={{ defaultTheme: 'system', storageKey: 'my-theme' }}
  auth={{ apiUrl: process.env.NEXT_PUBLIC_API_URL }}
>
  {children}
</BaseApp>
PropRole
projectName for monitor / debug. Enables window.monitor.
themedefaultTheme, storageKey, and optional style (preset + CSS-var overrides).
auth, analytics, centrifugo, errorTracking, errorBoundary, swr, pwaInstall, monitor, debugOptional integrations.

theme.style

Mounts ThemeStyleBridge → injects <style id="djangocfg-baseapp-theme-style"> with --* variables. Merge order: imported globals → preset → vars (strongest).

PieceMeaning
presetOne of THEME_STYLE_PRESET_ORDER. Bundles live in THEME_STYLE_PRESETS.
vars.light / vars.darkPartial ThemeCssVarMap — HSL triplets (192 90% 35%); radius accepts any CSS length.

Presets: default · django-cfg · ios · soft · dense · high-contrast.

Playground-only buckets (shadows, typography, spacing) are not injected — export full CSS from the Theme Configurator when you need them.

Exports: ThemeStyleConfig, ThemeCssVarKey, ThemeCssVarMap, ThemeStylePresetId, THEME_STYLE_PRESETS, THEME_STYLE_PRESET_ORDER, buildThemeStyleSheet, ThemeStyleBridge.

AppLayout

Wraps BaseApp and picks admin → private → public layout by path (matchesPath / enabledPath). noLayoutPaths skips the shell entirely (fullscreen / embeds). publicChrome merges navbar/footer/main spacing defaults.

<AppLayout
  layouts={{
    public:  { component: PublicLayout,  enabledPath: ['/', '/legal', '/contact'] },
    private: { component: PrivateLayout, enabledPath: ['/dashboard'] },
    admin:   { component: AdminLayout,   enabledPath: '/admin' },
    noLayoutPaths: ['/embed', '/ui'],
  }}
  baseApp={{ project: 'my-app', theme: { defaultTheme: 'system' }, auth: { apiUrl: '…' } }}
  i18n={{ locale, locales, onLocaleChange }}
>
  {children}
</AppLayout>

i18n is required for correct path matching when using next-intl or any locale-prefixed routing. Without it the fallback regex can mis-strip 2-letter path segments (e.g. /ui/* treated as locale ui).

Layouts

ComponentUse
PublicLayoutMarketing / docs. Slots for navbar + footer. All anchors render through <Link> from @djangocfg/ui-core/components — wrap with LinkProvider higher in the tree to inject a locale-aware Link (e.g. next-intl). All three navbars accept controls + i18n to show theme / locale switchers next to UserMenu (same shape as DefaultFooter.controls). See PublicLayout README for full props, navbar variants (FloatingNavbar / FlushNavbar / MinimalNavbar), DefaultFooter, NavAction, NavControls, and hooks.
PrivateLayoutApp shell — sidebar + header.
AuthLayoutSign-in flows.
AdminLayoutAdmin console.
ProfileLayoutProfile page — avatar, editable fields, 2FA, tabs, slots (see below).

ProfileLayout

<ProfileLayout enable2FA enableDeleteAccount tabs={tabs} slots={slots} />
PropTypeRole
enable2FAbooleanShow Security tab with 2FA management.
enableDeleteAccountbooleanShow Delete account in menu.
tabsProfileTab[]Extra tabs appended after built-in ones.
slots.headerBadgeReactNodeNext to user name (plan, role…).
slots.headerMenuItemsReactNodeExtra DropdownMenuItems in menu.
slots.headerAfterReactNodeBelow avatar row, above tabs.
slots.footerReactNodeBelow all tab content.

i18n

import { useLocaleSwitcher } from '@djangocfg/nextjs/i18n/client';

const { locale, locales, changeLocale } = useLocaleSwitcher();
<AppLayout i18n={{ locale, locales, onLocaleChange: changeLocale }}>{children}</AppLayout>

Monitor & debug

project on BaseApp enables window.monitor. Debug panel: Cmd+D or ?debug=1.

Utilities

APIRole
useErrorEmitter, emitRuntimeErrorError tracking hooks.
ErrorLayout (/components/errors)404 / error pages.
RedirectPageAuth redirect helper.
PrivacyPage, TermsPage, … (/pages/legal)Legal templates.

Package exports

PathContents
@djangocfg/layoutsBarrel.
@djangocfg/layouts/layoutsLayout components.
@djangocfg/layouts/componentsMisc.
@djangocfg/layouts/pages/legalLegal pages.
@djangocfg/layouts/stylesBase CSS.

Extensions

@djangocfg/ext-newsletter, ext-knowbase, ext-leads, ext-payments, ext-support, …

License

MIT — DjangoCFG

Keywords

layouts

FAQs

Package last updated on 25 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts