You must include the associated styles in your application, otherwise the resize handles will not be visible and will not work properly.
// In your JS/TS entry point:import 'react-resizable/css/styles.css';
Or import it in your CSS:
@import 'react-resizable/css/styles.css';
If you're using a bundler that doesn't support CSS imports, you can find the styles at node_modules/react-resizable/css/styles.css and include them manually.
TypeScript
As of 4.0.0, the library is authored in TypeScript and ships bundled type
declarations in build/*.d.ts. You do not need to install
@types/react-resizable; if you previously installed it, remove it so the
bundled types take precedence:
Public types are re-exported from the package root:
import { Resizable, ResizableBox, // types type ResizeCallbackData, type ResizeHandleAxis, type Axis, type Props as ResizableProps,} from 'react-resizable';
Flow
Flow is no longer supported as of 4.0.0. Earlier versions shipped
*.js.flow sidecar files generated from the Flow-annotated source; those
have been removed.
If you still need Flow types, you can vendor the last Flow-annotated source
locally from the 3.2.0 tag.
They will not be updated to reflect changes landing after 4.0.0. The
official recommendation is to migrate to TypeScript.
<Resizable>: A raw component that does not have state. Use as a building block for larger components, by listening to its callbacks and setting its props.
<ResizableBox>: A simple <div {...props} /> element that manages basic state. Convenient for simple use-cases.
You can define a function as a handle, which will simply receive an axis (see above ResizeHandleAxis type) and ref. This may be more clear to read, depending on your coding style.