# responsive-img-material-ui

> A material-ui component which display an image from different sources based on the page's current width (based on material-ui defined breakpoints).

Latest version **2.2.0** (published 2019-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install responsive-img-material-ui
pnpm add responsive-img-material-ui
yarn add responsive-img-material-ui
bun add responsive-img-material-ui
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2019-08-21 |
| First published | 2019-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Iulian Radu |
| Maintainers | iulian-radu-at |
| Keywords | img, material-ui, img-material-ui, responsive-img-material-ui, react, react-component, ui, material design |

## Links

- npm: https://www.npmjs.com/package/responsive-img-material-ui
- Repository: https://github.com/iulian-radu-at/img-material-ui
- Homepage: https://github.com/iulian-radu-at/img-material-ui#readme
- Issues: https://github.com/iulian-radu-at/img-material-ui/issues
- npm.io page: https://npm.io/package/responsive-img-material-ui

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.9.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.9.0
- [@material-ui/core](https://npm.io/package/@material-ui/core.md) ^4.3.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2019-08-21
- 2.1.0 — 2019-07-11
- 2.0.0 — 2019-06-06
- 1.0.2 — 2019-04-20
- 1.0.1 — 2019-04-20

## README

# responsive-img-material-ui

A material-ui component which displays an image from different sources based on the page's current width (based on material-ui defined breakpoints).

The order of breakpoints: xs, sm, md, lg, xl. You can find [here](https://material-ui.com/layout/breakpoints) the values defined currently by material-ui for these breakpoints. 

---

## Demo

You can access the storybook for this component [here](https://iulian-radu-at.github.io/responsive-img-material-ui/).

## Props

The component accepts the props defined bellow in the table.

### Props accepted by ResonsiveImgMaterialUi

| Name  | Type          | Required | Default   | Description                                                                         |
|-------|---------------|----------|-----------|-------------------------------------------------------------------------------------|
| id    | string        | no       | undefined | The id of the field                                                                 |
| lg    | string        | no*      | undefined | Source used for the lg breakpoint and wider screens (if not overridden)             |
| md    | string        | no*      | undefined | Source used for the md breakpoint and wider screens (if not overridden)             |
| sm    | string        | no*      | undefined | Source used for the sm breakpoint and wider screens (if not overridden)             |
| xl    | string        | no*      | undefined | Source used for the xl breakpoint and wider screens (if not overridden)             |
| xs    | string        | no*      | undefined | Source used for the xs breakpoint and bellow, and wider screens (if not overridden) |
| style | CSSProperties | no       | undefined | The style applied to the field                                                      |

no* means that at least one of them should be defined or an exception is triggered.

---

## Versions

| ResponsiveImgMaterialUi _uses_ | Material-ui | React  |
|-------------------------------:|:-----------:|:------:|
|                          1.0.x |    3.9.3    | 16.8.6 |
|                          2.0.x |    4.0.2    | 16.8.6 |
|                          2.1.x |    4.2.0    | 16.8.6 |
|                          2.2.x |    4.3.3    | 16.9.0 |

### About versioning schema used for ResponsiveImgMaterialUi

- Major - it will be increased if the major version of the dependat package changes or there are breaking changes in the code of ResponsiveImgMaterialUi
- Minor - it will be increased if no major version of the dependat package changes, but there are changes of the minor or patch versions of it
- Patch - it will be increased if there are no changes of the dependat packages, but there are non breaking changes in the code of ResponsiveImgMaterialUi

---

## Example

Displaying an image in three sizes based on the current window size:

```js
import * as React from "react";
import ResponsiveImgMaterialUi from "responsive-img-material-ui";

class App extends React.Component {
  render() {
    return (
      <div className="App">
        <ResponsiveImgMaterialUi
          xs="/img/logo-small.jpg"
          md="/img/logo-medium.jpg"
          lg="/img/logo-large.jpg"
        />
      </div>
    );
  }
}

export default App;
```

---

## Changelog

### 1.0.1

- responsive-img-material-ui is made publicly available

### 1.0.2

- Corrected the way we decide which provided src is used

### 2.0.0

- Updated packages

### 2.1.0

- Updated packages

### 2.2.0

- Updated packages

---
_Source: https://npm.io/package/responsive-img-material-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
