# @twp0217/react-inline-edit

> Inline edit component for React

Latest version **1.0.7** (published 2022-02-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @twp0217/react-inline-edit
pnpm add @twp0217/react-inline-edit
yarn add @twp0217/react-inline-edit
bun add @twp0217/react-inline-edit
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2022-02-09 |
| First published | 2021-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 39.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | twp0217 |
| Maintainers | twp0217 |
| Keywords | react, react-component, react-inline-edit, inline-edit |

## Links

- npm: https://www.npmjs.com/package/@twp0217/react-inline-edit
- Repository: https://github.com/twp0217/react-inline-edit
- Homepage: https://github.com/twp0217/react-inline-edit#readme
- Issues: https://github.com/twp0217/react-inline-edit/issues
- npm.io page: https://npm.io/package/@twp0217/react-inline-edit

## Dependencies (1)

- [classnames](https://npm.io/package/classnames.md) ^2.3.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.7 (latest) — 2022-02-09
- 1.0.6 — 2021-12-13
- 1.0.5 — 2021-12-13

## README

# react-inline-edit

Inline edit component for React（基于 React 的内联编辑组件）

## 安装

```bash
npm install @twp0217/react-inline-edit --save
```

## 使用

```typescript
import React from 'react';
import InlineEdit from '@twp0217/react-inline-edit';

export default () => {
  const [editValue, setEditValue] = React.useState<string>('');

  return (
    <InlineEdit
      defaultValue={editValue}
      readView={editValue || '请点击输入值'}
      editView={<input placeholder="请输入值" />}
      onConfirm={setEditValue}
    />
  );
};
```

## API

### InlineEditProps

| 名称           | 类型                 | 默认值    | 说明               |
| -------------- | -------------------- | --------- | ------------------ |
| className      | string               | -         | 类名               |
| style          | React.CSSProperties  | -         | 样式               |
| disabled       | `boolean`            | `false`   | 是否禁用           |
| keepOpenOnBlur | `boolean`            | `false`   | 失去焦点时保持打开 |
| hideActions    | `boolean`            | `false`   | 是否隐藏操作按钮   |
| confirmText    | `string`             | `Confirm` | 确认文本           |
| cancelText     | `string`             | `Cancel`  | 取消文本           |
| defaultValue   | `string`             | -         | 默认值             |
| isEditing      | `boolean`            | -         | 是否正在编辑       |
| loading        | `boolean`            | -         | 加载中             |
| placement      | `top` \| `bottom`    | -         | 按钮位置           |
| readView       | `React.ReactNode`    | -         | 查看视图           |
| editView       | `React.ReactNode`    | -         | 编辑视图           |
| onEdit         | `() => void`         | -         | 编辑事件           |
| onBlur         | `() => void`         | -         | 失去焦点事件       |
| onConfirm      | `(value: T) => void` | -         | 确认事件           |
| onCancel       | `() => void`         | -         | 取消事件           |

## 支持

- 如果项目对你有帮助，请点颗星星:star:，谢谢。
- 如果你对项目有想法、问题、BUG，欢迎讨论。

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