Comments (2)
This library, indeed, is poorly documented, and it's not immediately clear how to get things running, how things are passed down and how to use them. Alas, here you go:
//app.js
import Split from "react-split-grid";
import "./styles.css";
export default function App() {
return (
<Split
render={({ getGridProps, getGutterProps }) => (
<div className="grid" {...getGridProps()}>
<div />
<div
className="gutter-col gutter-col-1"
{...getGutterProps("column", 1)}
/>
<div />
<div
className="gutter-col gutter-col-2"
{...getGutterProps("column", 2)}
/>
<div />
<div
className="gutter-col gutter-col-3"
{...getGutterProps("column", 3)}
/>
<div />
<div />
<div
className="gutter-row gutter-row-1"
{...getGutterProps("row", 1)}
/>
<div />
</div>
)}
/>
);
}
You also need some barebones styling:
//style.css
.grid {
display: grid;
grid-template-rows: 1fr 10px 1fr;
grid-template-columns: 1fr 10px 1fr 10px 1fr;
height: 700px;
width: 700px;
border: 2px solid grey;
align-self: stretch;
justify-self: stretch;
box-sizing: border-box;
row-gap: 0px;
column-gap: 0px;
}
.gutter-col {
grid-row: 1/-1;
cursor: col-resize;
background-color: rgb(229, 231, 235);
background-repeat: no-repeat;
background-position: 50%;
}
.gutter-col-1 {
grid-column: 2;
}
.gutter-col-3 {
grid-column: 4;
}
.gutter-row {
grid-column: 1/-1;
cursor: row-resize;
background-color: rgb(229, 231, 235);
background-repeat: no-repeat;
background-position: 50%;
}
.gutter-row-1 {
grid-row: 2;
}
from split.
Tyvm, got it working.
from split.
Related Issues (20)
- option to shrink neighbor panels while growing a panel
- Component inside Panel does not behave responsive
- Option to set maxSize/minSize to % rather than px HOT 1
- onDrag event callbacks don't return the elements that were split
- How to update properties without destroying and reinitialization? HOT 1
- showing error: requested module does not provide an export named 'Split'
- React split - add support for dynamically added panes
- the div nestes in gutter can't response to onclick?
- [Split-Grid] Gutters should be used in a two-dimensional way.
- Multiple track registration constructor vs add api (split-grid) HOT 1
- [split-grid] columnMaxSize(s) not working HOT 2
- [Split-Grid]: typo in typescript types HOT 4
- Is there a way to make Split work without gaps/gutters?
- Split.js: drag is not stopped before destroy
- Style : gutter cursor style when hover HOT 2
- Intervention : IgnoredEventCancel
- Server Error HOT 2
- Fetaure request: Allow individual min/max sizing of elements
- Error: 'Split' cannot be used as a JSX component - TS2786
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from split.