Photonix

LayoutContext

Provides context for layout-aware components to coordinate states (e.g., presence of a NavigationDrawer).

Overview

Drawer registered: no

Usage
"use client";

import { Box, LayoutProvider, Text, useLayout } from '@photonix/ultimate';

export default function LayoutContextBasicExample() {
    return (
        <LayoutProvider>
            <LayoutStatus />
        </LayoutProvider>
    );
}

function LayoutStatus() {
    const layout = useLayout();

    return (
        <Box bg="secondary" borderRadius="md" p="md">
            <Text variant="body-md">
                Drawer registered: {layout?.hasDrawer ? 'yes' : 'no'}
            </Text>
        </Box>
    );
}

Component API

LayoutProvider

Prop
Type
Default
Description
children
React.ReactNode
-

useLayout

Prop
Type
Default
Description
Returns
LayoutContextValue | null
-
Context with `hasDrawer`, `registerDrawer`, `unregisterDrawer`.

On this page

Overview
Component API
Photonix UI - React Components, Templates & Figma Design System