# smoothsizeswitch

> React component allowing animations on size transitions between auto sizes

Latest version **1.0.3** (published 2017-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install smoothsizeswitch
pnpm add smoothsizeswitch
yarn add smoothsizeswitch
bun add smoothsizeswitch
```

## 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 | 1.0.3 |
| Published | 2017-07-01 |
| First published | 2017-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Magee |
| Maintainers | amagee |
| Keywords | react-component, react |

## Links

- npm: https://www.npmjs.com/package/smoothsizeswitch
- Repository: https://github.com/amagee/smoothsizeswitch
- Homepage: https://github.com/amagee/smoothsizeswitch/issues
- Issues: https://github.com/amagee/smoothsizeswitch/issues
- npm.io page: https://npm.io/package/smoothsizeswitch

## Dependencies (3)

- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.6.1

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

- 1.0.3 (latest) — 2017-07-01
- 1.0.2 — 2017-07-01
- 1.0.1 — 2017-07-01
- 1.0.0 — 2017-07-01

## README

# Smooth Size Switch

CSS transitions do not work on element widths or heights
when transitioning between two auto sizes. This component
allows you to behave as if that restriction didn't exist,
by manipulating the elements' `max-width` and `max-height`
properties when the content is changed.

Idea stolen from [here](https://codepen.io/kriede/details/RVYXZW).

Usage example:

Installation:

    npm install smoothsizeswitch

Code:

    import React from 'react';
    import { SmoothSizeSwitch } from 'smoothsizeswitch';

    class MyComponent extends React.Component {
      constructor() {
        super();
        this.state = {selectedIndex: 0};
      }

      render() {
        return <div>
          <SmoothSizeSwitch
            style={{
              transition: 'all 250ms ease-out',
              backgroundColor: 'lightBlue'
            }}
            items={[
              <div onClick={() => this.setState({selectedIndex: 1})}>
                <p>123</p>
                <p>123</p>
                <p>123</p>
              </div>,
              <div onClick={() => this.setState({selectedIndex: 0})}>
                <p>234</p>
                <p>234</p>
                <p>234</p>
                <p>234</p>
                <p>234</p>
                <p>234</p>
                <p>234</p>
                <p>234</p>
              </div>,
            ]}
            selectedIndex={this.state.selectedIndex}
          />
        </div>;
      }
    }

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