Gathering detailed insights and metrics for vue-re-resizable
Gathering detailed insights and metrics for vue-re-resizable
Gathering detailed insights and metrics for vue-re-resizable
Gathering detailed insights and metrics for vue-re-resizable
npm install vue-re-resizable
Typescript
Module System
Node Version
NPM Version
55.9
Supply Chain
97.6
Quality
75.4
Maintenance
100
Vulnerability
100
License
TypeScript (46.51%)
Vue (46.19%)
JavaScript (6.32%)
HTML (0.74%)
CSS (0.24%)
Total Downloads
1,276
Last Day
3
Last Week
3
Last Month
8
Last Year
105
2 Stars
1,047 Commits
2 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
6.9.19-beta.5
Package Id
vue-re-resizable@6.9.19-beta.5
Unpacked Size
86.82 kB
Size
20.12 kB
File Count
14
NPM Version
8.5.0
Node Version
16.14.2
Cumulative downloads
Total Downloads
Last day
50%
3
Compared to previous day
Last week
-40%
3
Compared to previous week
Last month
-46.7%
8
Compared to previous month
Last year
-88%
105
Compared to previous year
1
This package transfer from package re-resizable
All option from package re-resizable supported!
📏 A resizable component for Vue.
CodeSandbox
CodeSandbox(TypeScript)
CodeSandbox(With hooks)
1$ npm install --save vue-re-resizable
defaultSize
1<Resizable 2 defaultSize={{ 3 width:320, 4 height:200, 5 }} 6> 7 Sample with default size 8</Resizable>
size
If you use size
props, please manage state by yourself.
1<Resizable 2 size={{ width: this.state.width, height: this.state.height }} 3 onResizeStop={(e, direction, ref, d) => { 4 this.setState({ 5 width: this.state.width + d.width, 6 height: this.state.height + d.height, 7 }); 8 }} 9> 10 Sample with size 11</Resizable>
defaultSize?: { width: (number | string), height: (number | string) };
Specifies the width
and height
that the dragged item should start at.
For example, you can set 300
, '300px'
, 50%
.
If both defaultSize
and size
omitted, set 'auto'
.
defaultSize
will be ignored when size
set.
size?: { width: (number | string), height: (number | string) };
The size
property is used to set the size of the component.
For example, you can set 300
, '300px'
, 50%
.
Use size
if you need to control size state by yourself.
className?: string;
The className
property is used to set the custom className
of a resizable component.
style?: { [key: string]: string };
The style
property is used to set the custom style
of a resizable component.
minWidth?: number | string;
The minWidth
property is used to set the minimum width of a resizable component. Defaults to 10px.
It accepts viewport as well as parent relative units. For example, you can set 300
, 50%
, 50vw
or 50vh
.
Same type of values can be applied to minHeight
, maxWidth
and maxHeight
.
minHeight?: number | string;
The minHeight
property is used to set the minimum height of a resizable component. Defaults to 10px.
maxWidth?: number | string;
The maxWidth
property is used to set the maximum width of a resizable component.
maxHeight?: number | string
;The maxHeight
property is used to set the maximum height of a resizable component.
grid?: [number, number];
The grid
property is used to specify the increments that resizing should snap to. Defaults to [1, 1]
.
snap?: { x?: Array<number>, y?: Array<number> };
The snap
property is used to specify absolute pixel values that resizing should snap to. x
and y
are both optional, allowing you to only include the axis you want to define. Defaults to null
.
snapGap?: number
The snapGap
property is used to specify the minimum gap required in order to move to the next snapping target. Defaults to 0
which means that snap targets are always used.
resizeRatio?: number | string;
The resizeRatio
property is used to set the number of pixels the resizable component scales by compared to the number of pixels the mouse/touch moves. Defaults to 1
(for a 1:1 ratio). The number set is the left side of the ratio, 2
will give a 2:1 ratio.
lockAspectRatio?: boolean | number;
The lockAspectRatio
property is used to lock aspect ratio.
Set to true
to lock the aspect ratio based on the initial size.
Set to a numeric value to lock a specific aspect ratio (such as 16/9
).
If set to numeric, make sure to set initial height/width to values with correct aspect ratio.
If omitted, set false
.
lockAspectRatioExtraWidth?: number;
The lockAspectRatioExtraWidth
property enables a resizable component to maintain an aspect ratio plus extra width.
For instance, a video could be displayed 16:9 with a 50px side bar.
If omitted, set 0
.
lockAspectRatioExtraHeight?: number;
The lockAspectRatioExtraHeight
property enables a resizable component to maintain an aspect ratio plus extra height.
For instance, a video could be displayed 16:9 with a 50px header bar.
If omitted, set 0
.
bounds?: ('window' | 'parent' | HTMLElement);
Specifies resize boundaries.
boundsByDirection?: boolean;
By default max dimensions based on left and top element position.
Width grow to right side, height grow to bottom side.
Set true
for detect max dimensions by direction.
For example: enable boundsByDirection
when resizable component stick on right side of screen and you want resize by left handler;
false
by default.
handleStyles?: HandleStyles;
The handleStyles
property is used to override the style of one or more resize handles.
Only the axis you specify will have its handle style replaced.
If you specify a value for right
it will completely replace the styles for the right
resize handle,
but other handle will still use the default styles.
handleClasses?: HandleClassName;
The handleClasses
property is used to set the className of one or more resize handles.
handleComponent?: HandleComponent;
The handleComponent
property is used to pass a React Component to be rendered as one or more resize handle. For example, this could be used to use an arrow icon as a handle..
handleWrapperStyle?: { [key: string]: string };
The handleWrapperStyle
property is used to override the style of resize handles wrapper.
handleWrapperClass?: string;
The handleWrapperClass
property is used to override the className of resize handles wrapper.
enable?: ?Enable;
The enable
property is used to set the resizable permission of a resizable component.
The permission of top
, right
, bottom
, left
, topRight
, bottomRight
, bottomLeft
, topLeft
direction resizing.
If omitted, all resizer are enabled.
If you want to permit only right direction resizing, set { top:false, right:true, bottom:false, left:false, topRight:false, bottomRight:false, bottomLeft:false, topLeft:false }
.
onResizeStart?: ResizeStartCallBack;
ResizeStartCallBack
type is below.
1type ResizeStartCallback = ( 2 e: SyntheticMouseEvent<HTMLDivElement> | SyntheticTouchEvent<HTMLDivElement>, 3 dir: ResizableDirection, 4 refToElement: HTMLDivElement, 5) => void;
Calls when resizable component resize start.
onResize?: ResizeCallback;
scale?: number
;The scale
property is used in the scenario where the resizable element is a descendent of an element using css scaling (e.g. - transform: scale(0.5)
).
as?: string | React.ComponentType
;By default the Resizable
component will render a div
as a wrapper. The as
property is used to change the element used.
ResizeCallback
type is below.
1type ResizeCallback = ( 2 event: MouseEvent | TouchEvent, 3 direction: ResizableDirection, 4 refToElement: HTMLDivElement, 5 delta: NumberSize, 6) => void;
Calls when resizable component resizing.
onResizeStop?: ResizeCallback;
ResizeCallback
type is below.
1type ResizeCallback = ( 2 event: MouseEvent | TouchEvent, 3 direction: ResizableDirection, 4 refToElement: HTMLDivElement, 5 delta: NumberSize, 6) => void;
Calls when resizable component resize stop.
updateSize(size: { width: number | string, height: number | string }): void
Update component size.
grid
, snap
, max/minWidth
, max/minHeight
props is ignored, when this method called.
1class YourComponent extends Component { 2 3 // ... 4 5 update() { 6 this.resizable.updateSize({ width: 200, height: 300 }); 7 } 8 9 render() { 10 return ( 11 <Resizable ref={c => { this.resizable = c; }}> 12 example 13 </Resizable> 14 ); 15 } 16 17 // ... 18}
If you have a feature request, please add it as an issue or make a pull request.
If you have a bug to report, please reproduce the bug in CodeSandbox to help us easily isolate it.
1npm test
No vulnerabilities found.
No security vulnerabilities found.