Skip to content

Components

WindowManagerProvider

Root provider that manages all window state.

<WindowManagerProvider
boundsRef={containerRef}
registry={appRegistry}
defaultWindows={initialWindows}
defaultIcons={initialIcons}
defaultWindowConfigs={windowConfigs}
initialFocusedWindowId="window-1"
onFocusChange={(windowId) => console.log("Focus:", windowId)}
>
{children}
</WindowManagerProvider>

Props

PropTypeDescription
childrenReactNodeChild components
defaultWindowsWindowState[]Initial windows to render
defaultIconsIconState[]Initial desktop icons
registryWindowRegistryComponent registry for Desktop
defaultWindowConfigsWindowConfigRegistryDefault window configs by componentId
boundsRefRefObject<HTMLElement>Container for bounds constraints
initialFocusedWindowIdstringWhich window to focus initially
onFocusChange(windowId: string | null) => voidCallback when focus changes

Window

Positioning container for a single window.

<Window id="window-1" className="my-window" style={{ background: "white" }}>
{/* Window content */}
</Window>

Props

PropTypeDescription
idstringWindow ID (must match state)
childrenReactNodeWindow content
classNamestringOptional CSS class
styleCSSPropertiesOptional inline styles

WindowFrame

Container for window chrome with built-in drag context. Use with TitleBar, Content, and ResizeHandles.

<WindowFrame
windowId={windowId}
enableDoubleClickMaximize
enableSnapToEdges
onSnapZoneChange={(zone) => setSnapPreview(zone)}
>
<TitleBar>...</TitleBar>
<Content>...</Content>
<ResizeHandles windowId={windowId} />
</WindowFrame>

Props

PropTypeDefaultDescription
windowIdstring-Window ID (required)
childrenReactNode-TitleBar, Content, ResizeHandles
classNamestring-Optional CSS class
styleCSSProperties-Optional inline styles
enableDoubleClickMaximizebooleantrueDouble-click title to maximize
enableSnapToEdgesbooleantrueEnable edge snapping
onSnapZoneChange(zone: 'left' | 'right' | null) => void-Snap zone change callback

TitleBar

Draggable title bar component. Must be used within WindowFrame.

<TitleBar className="h-10 bg-slate-900 px-3">
<Title />
<WindowControls />
</TitleBar>

Props

PropTypeDescription
childrenReactNodeTitle, controls, etc.
classNamestringOptional CSS class
styleCSSPropertiesOptional inline styles

Title

Renders the window title from context. Must be used within WindowFrame.

<Title className="text-white font-medium" />
{/* Or with custom content */}
<Title>
<Icon /> Custom Title
</Title>

Props

PropTypeDescription
childrenReactNodeCustom content (overrides title)
classNamestringOptional CSS class
styleCSSPropertiesOptional inline styles

WindowControls

Pre-built minimize, maximize, and close buttons. Must be used within WindowFrame.

<WindowControls
className="flex gap-1"
buttonClassName="p-1 rounded hover:bg-slate-700"
closeButtonClassName="hover:bg-red-600"
/>
{/* Show only some controls */}
<WindowControls controls={['minimize', 'close']} />
{/* Custom icons */}
<WindowControls
icons={{
minimize: <MinusIcon />,
maximize: <ExpandIcon />,
restore: <ShrinkIcon />,
close: <XIcon />,
}}
/>

Props

PropTypeDefaultDescription
controls('minimize' | 'maximize' | 'close')[]['minimize', 'maximize', 'close']Which controls to show
icons{ minimize?, maximize?, restore?, close? }Built-in SVGsCustom icons
classNamestring-Container class
styleCSSProperties-Container styles
buttonClassNamestring-Class for all buttons
buttonStyleCSSProperties-Styles for all buttons
closeButtonClassNamestring-Additional class for close

Content

Content area wrapper for window body. Must be used within WindowFrame.

<Content className="p-4 overflow-auto">
{children}
</Content>

Props

PropTypeDescription
childrenReactNodeContent to render
classNamestringOptional CSS class
styleCSSPropertiesOptional inline styles

ResizeHandles

Pre-built resize handles for all 8 directions.

<ResizeHandles
windowId={windowId}
minWidth={300}
minHeight={200}
maxWidth={800}
maxHeight={600}
/>
{/* Custom styling */}
<ResizeHandles
windowId={windowId}
className="hover:bg-blue-500/20"
directionClassNames={{ se: "bg-blue-500/50" }}
/>
{/* Custom render */}
<ResizeHandles
windowId={windowId}
renderHandle={({ direction, handleProps, style }) => (
<div {...handleProps} style={style} data-direction={direction} />
)}
/>

Props

PropTypeDefaultDescription
windowIdstring-Window ID (required)
thicknessnumber4Edge handle thickness (px)
cornerSizenumber8Corner handle size (px)
directionsResizeDirection[]All 8Which handles to render
hideWhenMaximizedbooleantrueHide when maximized
minWidthnumber | string100Minimum width
minHeightnumber | string50Minimum height
maxWidthnumber | string-Maximum width
maxHeightnumber | string-Maximum height
classNamestring-Class for all handles
directionClassNamesPartial<Record<ResizeDirection, string>>-Per-direction classes
directionStylesPartial<Record<ResizeDirection, CSSProperties>>-Per-direction styles
renderHandle(props) => ReactNode-Custom render function

Desktop

Auto-renders windows from the registry based on componentId.

<Desktop className="desktop-area" style={{ height: "100%" }}>
{({ component: Component, windowId, componentProps, windowState }) => (
<Window id={windowId}>
<Component windowId={windowId} {...componentProps} />
</Window>
)}
</Desktop>

Props

PropTypeDescription
children(props: DesktopRenderProps) => ReactNodeRender function
classNamestringOptional CSS class
styleCSSPropertiesOptional inline styles

Render Props

PropTypeDescription
componentComponentTypeThe resolved React component
windowIdstringThe window’s ID
componentIdstringThe component ID
componentPropsobjectProps to pass to component
windowStateWindowStateFull window state object

Taskbar

Headless taskbar component with render props.

<Taskbar>
{({ windows, activeWindowId, focusWindow, minimizeWindow, restoreWindow, closeWindow }) => (
<div className="taskbar">
{windows.map((w) => (
<button key={w.id} onClick={() => focusWindow(w.id)}>
{w.title}
</button>
))}
</div>
)}
</Taskbar>

Render Props

PropTypeDescription
windowsWindowState[]Array of all windows
activeWindowIdstring | nullCurrently focused window
focusWindow(id: string) => voidFocus a window
minimizeWindow(id: string) => voidMinimize a window
restoreWindow(id: string) => voidRestore a window
closeWindow(id: string) => voidClose a window

SnapPreviewOverlay

Visual preview overlay for snap zones during drag.

<SnapPreviewOverlay
zone={snapZone} // "left" | "right" | null
style={{ background: "rgba(0, 100, 255, 0.2)" }}
/>

Props

PropTypeDescription
zone"left" | "right" | nullActive snap zone
styleCSSPropertiesOptional inline styles

DesktopIcon

Headless component for individual desktop icons.

<DesktopIcon
id="icon-1"
gridConfig={{ cellWidth: 80, cellHeight: 90, gap: 8 }}
snapOnDrop={true}
>
{({ iconState, isSelected, isDragging, wasDragged, dragProps, onLaunch }) => (
<div {...dragProps} onClick={() => !wasDragged && onLaunch()}>
{iconState.label}
</div>
)}
</DesktopIcon>

Props

PropTypeDescription
idstringIcon ID
children(props: DesktopIconRenderProps) => ReactNodeRender function
gridConfigGridConfigGrid configuration
snapOnDropbooleanSnap only on drop

Render Props

PropTypeDescription
iconIdstringIcon ID
iconStateIconStateFull icon state
isSelectedbooleanWhether selected
isDraggingbooleanWhether being dragged
wasDraggedbooleanWhether moved (prevent click)
dragPropsobjectProps for drag element
onSelect(multiSelect?) => voidSelect handler
onLaunch() => voidLaunch window

DesktopIconGrid

Container that renders all icons with grid awareness.

<DesktopIconGrid
grid={{ cellWidth: 80, cellHeight: 90, gap: 8 }}
snapToGrid={true}
className="icon-grid"
>
{({ iconState, pixelPosition, gridPosition, isSelected, dragProps, openOrFocus }) => (
<div
{...dragProps}
style={{
position: "absolute",
left: pixelPosition.x,
top: pixelPosition.y,
}}
onDoubleClick={openOrFocus}
>
{iconState.label}
</div>
)}
</DesktopIconGrid>

Props

PropTypeDescription
children(props: DesktopIconGridRenderProps) => ReactNodeRender function
gridGridConfigGrid configuration
snapToGridbooleanEnable grid snapping
classNamestringOptional CSS class
styleCSSPropertiesOptional styles

Render Props

Extends DesktopIconRenderProps with:

PropTypeDescription
gridPosition{ row, column }Position in grid
pixelPositionPositionCurrent pixel position
isWindowOpenbooleanWhether window is open
openOrFocus() => voidOpens or focuses window