# @totebox/ui

> A library of UI components based on React.

Latest version **0.4.0** (published 2022-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @totebox/ui
pnpm add @totebox/ui
yarn add @totebox/ui
bun add @totebox/ui
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2022-03-09 |
| First published | 2019-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | NZ |
| Maintainers | nicolaszhao |
| Keywords | components, library, React |

## Links

- npm: https://www.npmjs.com/package/@totebox/ui
- Repository: https://github.com/nicolaszhao/totebox
- Homepage: https://github.com/nicolaszhao/totebox#readme
- Issues: https://github.com/nicolaszhao/totebox/issues
- npm.io page: https://npm.io/package/@totebox/ui

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

- 0.4.0 (latest) — 2022-03-09
- 0.3.0 — 2020-10-29
- 0.2.2 — 2020-06-04
- 0.2.1 — 2019-12-16
- 0.2.0 — 2019-12-13

## README

# @totebox/ui

## 安装

```
npm i @totebox/ui
```

确保你的项目中已经安装了以下依赖以及相应的版本：

```shell
npm i classnames@^2.2.0 react@^16.8.0 react-dom@^16.8.0 react-transition-group@^4.3.0
```

## 使用

```js
import { Animate, Loading, Modal, /*other components...*/ } from '@totebox/ui'
```

## 组件 API

* [Animate](###Animate)
* [Loading](###Loading)
* [Modal](###Modal)

### Animate

#### Props

| Props                      | Description                                                  | Type    | Default |
| -------------------------- | ------------------------------------------------------------ | ------- | ------- |
| in                         | 显示/隐藏元素                                                | Boolean | `false` |
| [animation](####animation) | 动画展现方式                                                 | String  | "fade"  |
| duration                   | 动画展现时间                                                 | Number  | 400     |
| 其他属性                   | 参考：[react-transition-group](https://reactcommunity.org/react-transition-group/css-transition) |         |         |

#### animation

| animation       |                  |                   |                |
| --------------- | ---------------- | ----------------- | -------------- |
| `fade`          | `fadeDown`       | `fadeLeft`        | `fadeRight`    |
| `fadeUp`        |                  |                   |                |
| `flip`          | `flipX`          | `flipY`           |                |
| `rotate`        | `rotateDownLeft` | `rotateDownRight` | `rotateUpLeft` |
| `rotateUpRight` |                  |                   |                |
| `zoom`          |                  |                   |                |

#### Example

```react
<Animate in={visible} animation="zoom" duration="600">
  <div className="loading" />
</Animate>
```

### Loading

#### Props

| Props    | Description                 | Type    | Default |
| -------- | --------------------------- | ------- | ------- |
| visible  | 组件显示/隐藏               | Boolean | false   |
| 其他属性 | 参考：[Animate](###Animate) |         |         |

#### Example

```react
<Loading visible={loading} />
```

### Modal

#### Props

| Props      | Description                 | Type     | Default        |
| --------- | -------------------- | -------- | ------------- |
| title     | Modal 标题           | String   | "Title" |
| visible   | Modal 是否可见       | Boolean  | `false`       |
| animation | 动画展现方式         | String   | "zoom"        |
| onClose   | 点击右上角叉后的回调 | Function | noop          |

#### Example

```react
const [modalVisible, setModalVisible] = useState(true);

<Modal
  title="Example"
  visible={modalVisible}
  animation="flip"
  onClose={() => setModalVisible(false)}
>
  <p>Message...</p>
</Modal>
```

## License

[MIT](https://github.com/nicolaszhao/totebox/blob/master/LICENSE) © [nicolaszhao](https://github.com/nicolaszhao)

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