Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-page-split
Advanced tools
React components & hooks for page splitting.
IE / Edge | Firefox | Chrome | Opera |
---|---|---|---|
Edge | 29+ | 32+ | 20+ |
npm install --save react-page-split
Proportional
, Cascade
, ReverseCascade
, and Limit
resizes.min-width
and max-width
on a panel.11px
wide, but appears 1px
wide until hovered.<button>
on a custom divider.<button>
click.import {
HorizontalPageSplit,
VerticalPageSplit
} from 'react-page-split';
import 'react-page-split/style.css';
function Example() {
return (
<HorizontalPageSplit widths={['20%', '50%', '30%']}>
<VerticalPageSplit>
<div>Top left</div>
<div>Middle left</div>
<div>Bottom left</div>
</VerticalPageSplit>
<div>Middle</div>
<VerticalPageSplit heights={['25%', '75%']}>
<div>Top right</div>
<div>Bottom right</div>
</VerticalPageSplit>
</HorizontalPageSplit>
)
}
There are four defined resizes that occur when dragging a divider. The default is for panels to be resized at
a Proportional
rate.
A custom Resize
can also be provided.
A Proportional
resize affects all panels across the axis at a proportionally equal rate.
import {
HorizontalPageSplit,
Proportional
} from 'react-page-split';
import 'react-page-split/style.css';
function CascadeBehaviourExample() {
return (
<HorizontalPageSplit resize={Proportional}>
<div>A</div>
<div>B</div>
<div>C</div>
<div>D</div>
</HorizontalPageSplit>
)
}
A Cascade
resize cascades across all panels along the axis, starting with the closest panel.
import {
HorizontalPageSplit,
Cascade
} from 'react-page-split';
import 'react-page-split/style.css';
function CascadeBehaviourExample() {
return (
<HorizontalPageSplit resize={Cascade}>
<div>A</div>
<div>B</div>
<div>C</div>
<div>D</div>
</HorizontalPageSplit>
)
}
A ReverseCascade
resize cascades across all panels along the axis, starting with the furthest panel.
import {
HorizontalPageSplit,
ReverseCascade
} from 'react-page-split';
import 'react-page-split/style.css';
function CascadeReverseBehaviourExample() {
return (
<HorizontalPageSplit resize={ReverseCascade}>
<div>A</div>
<div>B</div>
<div>C</div>
<div>D</div>
</HorizontalPageSplit>
)
}
A Limit
resize causes a resize to be limited within panels adjacent to the dragged divider.
import {
HorizontalPageSplit,
Limit
} from 'react-page-split';
import 'react-page-split/style.css';
function LimitBehaviourExample() {
return (
<HorizontalPageSplit resize={Limit}>
<div>A</div>
<div>B</div>
<div>C</div>
<div>D</div>
</HorizontalPageSplit>
)
}
All parts of the library may be customized, either via CSS or via the API.
The hooks allow you to apply the necessary styles, classes, and event listeners to any element.
useDivider
import {
DividerProps,
HorizontalPageSplit,
useDivider
} from 'react-page-split';
import 'react-page-split/style.css';
function CustomDividerExample() {
return (
<HorizontalPageSplit divider={CustomDivider}>
<div>A</div>
<div>B</div>
</HorizontalPageSplit>
)
}
function CustomDivider(props: DividerProps<HTMLDivElement>) {
const {
index,
...rest
} = props;
const {
children,
...dividerProps
} = useDivider({
className: 'custom-divider',
...rest
});
return (
<div {...dividerProps}>
<span>Divider #{index + 1}</span>
{children}
<button>My custom button</button>
</div>
);
}
The components take various props that allow you to embed custom behaviour.
<HorizontalPageSplit divider={...}>
import {
HorizontalDivider,
HorizontalDividerProps,
HorizontalPageSplit
} from 'react-page-split';
import 'react-page-split/style.css';
function CustomDividerExample() {
return (
<HorizontalPageSplit divider={CustomDivider}>
<div>A</div>
<div>B</div>
</HorizontalPageSplit>
)
}
function CustomDivider(props: HorizontalDividerProps) {
const {
index,
children,
...rest
} = props;
return (
<HorizontalDivider className="custom-divider" index={index} {...rest}>
<span>Divider #{index + 1}</span>
{children}
<button>My custom button</button>
</HorizontalDivider>
);
}
Bug reports and pull requests are welcome on GitHub.
This project is available under the terms of the ISC license. See the
LICENSE
file for the copyright information and licensing terms.
FAQs
React components & hooks for page splitting.
The npm package react-page-split receives a total of 0 weekly downloads. As such, react-page-split popularity was classified as not popular.
We found that react-page-split demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.