百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

re-resizable

> 前端框架
开源

一个用于React的可调整大小组件。

2.7K stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个用于React的可调整大小组件。

一个用于 React 的可调整大小组件。

目录

  • 截图
  • 在线演示
    • Storybook
    • CodeSandbox
  • 安装
  • 使用
  • 属性
  • 实例 API
    • updateSize(size: { width: number | string, height: number | string }): void
  • 测试
  • 相关

截图

在线演示

Storybook

CodeSandbox

安装

bash
$ npm install --save re-resizable

使用

使用 defaultSize 的示例

javascript
import { Resizable } from 're-resizable';

<Resizable
  defaultSize={{
    width: 320,
    height: 200,
  }}
>
  Sample with default size
</Resizable>

如果你只想设置宽度,只需提供宽度属性即可。 The height property will automatically be set to auto, which means it will adjust 100% of its parent's height:

javascript
import { Resizable } from 're-resizable';

<Resizable
  defaultSize={{
    width: 320
  }}
>
  Sample with default size
</Resizable>

Example with size

如果你使用 size 属性,请自行管理状态。

javascript
import { Resizable } from 're-resizable';

<Resizable
  size={{ width: this.state.width, height: this.state.height }}
  onResizeStop={(e, direction, ref, d) => {
    this.setState({
      width: this.state.width + d.width,
      height: this.state.height + d.height,
    });
  }}
>
  Sample with size
</Resizable>

属性

defaultSize?: { width?: (number | string), height?: (number | string) };

指定拖拽项应起始的width和height。 为了考试

[Storybook](http://bokuweb.github.io/re-resizable/) [CodeSandbox](https://codesandbox.io/s/xp9p7272m4) [CodeSandbox(TypeScript)](https://codesandbox.io/s/1vwo2p4l64) [CodeSandbox(With hooks)](https://codesandbox.io/s/blissful-joliot-d3unx)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptreactreact-componentresizableresize

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架