Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrelmlins/svelte-resize-observer

Element resize observer to Svelte
https://github.com/andrelmlins/svelte-resize-observer

library observer resize svelte

Last synced: 1 day ago
JSON representation

Element resize observer to Svelte

Awesome Lists containing this project

README

        

# Svelte Resize Observer

[![npm version](https://badge.fury.io/js/svelte-resize-observer.svg)](https://www.npmjs.com/package/svelte-resize-observer) • [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/andrelmlins/svelte-resize-observer/blob/master/LICENSE) • [![Build Status](https://travis-ci.com/andrelmlins/svelte-resize-observer.svg?branch=master)](https://travis-ci.com/andrelmlins/svelte-resize-observer) • [![Netlify Status](https://api.netlify.com/api/v1/badges/fbeb8033-5f7e-47cb-83e0-0fc7e89ad54b/deploy-status)](https://app.netlify.com/sites/svelte-resize-observer/deploys) • [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/andrelmlins/svelte-resize-observer.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/andrelmlins/svelte-resize-observer/context:javascript)

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](https://github.com/sveltejs/sapper-template#using-external-components).

## Demo [Link](https://svelte-resize-observer.netlify.com/)

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:

```js

import ResizeObserver from "svelte-resize-observer";

div {
width: 400px;
height: 400px;
}


console.log(e.detail.target)} />

```

## 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

[![NPM](https://nodei.co/npm/svelte-resize-observer.png)](https://nodei.co/npm/svelte-resize-observer/)

## License

Svelte Resize Observer is open source software [licensed as MIT](https://github.com/andrelmlins/svelte-resize-observer/blob/master/LICENSE).