Socket
Socket
Sign inDemoInstall

use-resizable

Package Overview
Dependencies
11
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    use-resizable

get resize value use react-hook from mousedown, mousemove, mouseup event (avaible touch event)


Version published
Weekly downloads
10
increased by100%
Maintainers
1
Install size
125 kB
Created
Weekly downloads
 

Readme

Source

use-resizable

get resize value use react-hook from mousedown, mousemove, mouseup event (avaible touch event)

demo

https://codesandbox.io/s/funny-mcnulty-4f1j0

usage

import * as React from "react";
import useResizable from "use-resizable";

function Layout({ children }: React.PropsWithChildren<{}>) {
  const { size, handler } = useResizable({
    minSize: 300,
    maxSize: 600,
    width: 400,
    direction: "left", // size scale direction
  });
  return (
    <div style={{ width: size, position: "relative" }}>
      {children}
      <div
        style={{
          position: "absolute",
          left: "-5px",
          top: 0,
          height: "100%",
          width: "10px",
          cursor: "col-resize"
        }}
        onMouseDown={handler}
        onTouchStart={handler}
      />
    </div>
  );
}

Keywords

FAQs

Last updated on 31 Dec 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc