react-spaces
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

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.

<ViewPort />

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:

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.5.1117latest
0.5.1-beta.111beta

Version History

VersionDownloads (Last 7 Days)Published
0.5.1117
0.5.1-beta.111
0.5.1-beta.100
0.5.1-beta.81
0.5.1-beta.70
0.5.1-beta.60
0.5.1-beta.51
0.5.1-beta.40
0.5.1-beta.31
0.5.1-beta.22
0.5.1-beta.11
0.5.096
0.5.0-node-20x.11
0.4.2-node-20x.31
0.4.2-node-20x.21
0.4.2-node-20x.11
0.4.2-beta.41
0.4.2-beta.31
0.4.2-beta.21
0.4.2-beta.11
0.4.1115
0.4.1-beta.21
0.4.1-beta.11
0.4.01
0.4.0-beta.11
0.3.9232
0.3.830
0.3.71
0.3.612
0.3.54
0.3.417
0.3.31
0.3.3-beta-32
0.3.3-beta-20
0.3.3-beta-11
0.3.262
0.3.10
0.3.00
0.2.691
0.2.50
0.2.41
0.2.30
0.2.21
0.2.12
0.2.1-beta.92
0.2.1-beta.80
0.2.1-beta.70
0.2.1-beta.60
0.2.1-beta.50
0.2.1-beta.40
0.2.1-beta.31
0.2.1-beta.20
0.2.1-beta.12
0.2.08
0.2.0-beta.111
0.2.0-beta.102
0.2.0-beta.91
0.2.0-beta.82
0.2.0-beta.70
0.2.0-beta.60
0.2.0-beta.52
0.2.0-beta.41
0.1.2994
0.1.281
0.1.272
0.2.0-beta.31
0.1.262
0.2.0-beta.22
0.2.0-beta.11
0.1.251
0.1.240
0.1.231
0.1.221
0.1.22-alpha.11
0.1.210
0.1.200
0.1.20-alpha.42
0.1.20-alpha.31
0.1.20-alpha.21
0.1.20-alpha.11
0.1.192
0.1.181
0.1.171
0.1.16-beta.01
0.1.161
0.1.152
0.1.142
0.1.131
0.1.121
0.1.111
0.1.102
0.1.91
0.1.80
0.1.71
0.1.61
0.1.51
0.1.41
0.1.31
0.1.21
0.1.11
0.1.01

Package Sidebar

Install

npm i react-spaces

Weekly Downloads

982

Version

0.5.1

License

MIT

Unpacked Size

867 kB

Total Files

139

Last publish

Collaborators

  • allan.eagle