react-spaces

React components that allow you to divide a page or container into nestable anchored, scrollable and resizable spaces.

Github星跟蹤圖

React Spaces

NPM Azure Pipelines

React Spaces allow you to divide a page or container HTML element into spaces. These spaces know how to behave in relation to each other and can also be divided into further nested spaces.

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.

<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:



主要指標

概覽
名稱與所有者aeagle/react-spaces
主編程語言TypeScript
編程語言CSS (語言數: 6)
平台
許可證MIT License
所有者活动
創建於2019-07-21 03:58:06
推送於2025-03-13 17:07:36
最后一次提交2025-03-13 17:00:39
發布數76
最新版本名稱v0.5.1 (發布於 2025-03-13 17:07:36)
第一版名稱v0.1.0 (發布於 )
用户参与
星數1.3k
關注者數12
派生數26
提交數588
已啟用問題?
問題數69
打開的問題數10
拉請求數82
打開的拉請求數12
關閉的拉請求數18
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?