MCPcopy Index your code
hub / github.com/aeagle/react-spaces

github.com/aeagle/react-spaces @sb-v20240421.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release sb-v20240421.5.0 ↗ · + Follow
162 symbols 390 edges 72 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

React Spaces

NPM Azure Pipelines

An easy to understand and nestable layout system, React Spaces allow you to divide a page or container into anchored, scrollable and resizable spaces enabling you to build desktop/mobile type user interfaces in the browser.

Rather than a library of visual UI components, Spaces are intended to be the reusable foundational blocks for laying out a UI which responds neatly to view port resizes leaving you to fill them with whatever components you want.

  • No styling to achieve simple or complex layouts.
  • Spaces know how to behave in relation to each other and resize accordingly.
  • Spaces don't have any visual element to them (even padding or margins). You can fill them with whatever you want.

Version 0.2.0 release - read release notes here.

View full documentation here.

Top level spaces

Used at the top level of all other spaces.

\

This space will take over the full viewport of the browser window. Resizing the browser window will automatically adjust the size of this space and all the nested spaces.

\<Fixed />

This space can be given a height and optionally a width (by default it will size to 100% of it's container). All nested spaces will be contained within this fixed size space.

Anchored spaces

These can be used within the top-level spaces \<ViewPort /> and \<Fixed /> or nested within other spaces.

\<Left /> and \<Right />

A space anchored to the left or right of the parent container/space. A size can be specified in pixels or as a percentage to determine its width.

\<Top /> and \<Bottom />

A space anchored to the top or bottom of the parent container/space. A size can be specified in pixels or as a percentage to determine its height.

There are resizable versions of these components called \<LeftResizable />, \<RightResizable />, \<TopResizable /> and \<BottomResizable /> which allow the spaces to be resized from the outer edge by dragging with the mouse.

Other

\<Fill />

A space which consumes any available area left in the parent container/space taking into account any anchored spaces on every side.

\<Positioned />

A space which can be absolutely placed within a parent space either by top, left, width and height or by top, left, right and bottom.

\<Layer />

Layers allow you to create layers within a parent space, for example:

<ViewPort>
    <Layer zIndex="{0}"> <LeftResizable size="20%" /> // floating sidebar </Layer>
    <Layer zIndex="{1}">
        <Fill />
    </Layer>
</ViewPort>

\<Centered />

Centres the content of a space horizontally and vertically.

\<CenteredVertically />

Centres the content of a space vertically.

Getting started

To get started with React Spaces you need:

npm install react-spaces --save
import * as Spaces from "react-spaces";

View full documentation here.

Donation

If you find this library useful, consider making a small donation to fund a cup of coffee:

Extension points exported contracts — how you extend this code

ICommonProps (Interface)
(no doc)
src/core-types.ts
IReactSpacesOptions (Interface)
(no doc)
src/core-react.ts
IResizeChange (Interface)
(no doc)
src/core-resizing.ts
ICenteredProps (Interface)
(no doc)
src/components/Centered.tsx
Expect (Interface)
(no doc)
@types/global.d.ts
ISpaceProps (Interface)
(no doc)
src/core-types.ts
IReactEvents (Interface)
(no doc)
src/core-react.ts
IProps (Interface)
(no doc)
src/components/Layer.tsx

Core symbols most depended-on inside this repo

description
called by 149
src/components/stories/Utils.tsx
css
called by 57
src/core-utils.ts
mutateComponent
called by 33
src/components/tests/Common.tsx
addHandleCss
called by 25
src/core-utils.ts
coalesce
called by 14
src/core-utils.ts
commonPropsTests
called by 13
src/components/tests/Common.tsx
createSideAdjuster
called by 12
src/core-resizing.ts
fixUp
called by 12
src/components/tests/Common.tsx

Shape

Function 123
Interface 25
Enum 8
Class 4
Method 2

Languages

TypeScript100%

Modules by API surface

src/core-types.ts16 symbols
src/components/stories/Utils.tsx15 symbols
src/core-utils.ts14 symbols
src/core-react.ts13 symbols
src/core.ts11 symbols
src/components/tests/Common.tsx10 symbols
src/components/Anchored.tsx10 symbols
src/core-resizing.ts9 symbols
src/components/Space.tsx7 symbols
src/core-dragging.ts6 symbols
src/components/tests/TestUtils.ts5 symbols
src/components/stories/00-docs/01-GettingStarted.components.tsx3 symbols

For agents

$ claude mcp add react-spaces \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact