svelte-resize-observer
v2.0.0
Published
Element resize observer to Svelte
Downloads
1,467
Readme
Svelte Resize Observer
Element resize observer to Svelte
Installation
npm i svelte-resize-observer
// OR
yarn add svelte-resize-observer
Note: to use this library in sapper, install as devDependency. See the link.
Demo Link
Local demo:
git clone https://github.com/andrelmlins/svelte-resize-observer.git
cd svelte-resize-observer
npm install && npm run dev
Examples
An example of how to use the library:
<script>
import ResizeObserver from "svelte-resize-observer";
</script>
<style>
div {
width: 400px;
height: 400px;
}
</style>
<div>
<ResizeObserver on:resize={(e) => console.log(e.detail.target)} />
</div>
Properties
Component props:
| Prop | Type | Description | | ------------- | ---- | ---------------------- | | elementResize | node | Element to bind resize | | resize | func | Call with resize |
NPM Statistics
Download stats for this NPM package
License
Svelte Resize Observer is open source software licensed as MIT.