# @42shadow42/react-editable-title

> An editable title implementation for the react.

Latest version **2.0.8** (published 2020-05-16) · GPL 3.0 license · 0 weekly downloads

## Install

```sh
npm install @42shadow42/react-editable-title
pnpm add @42shadow42/react-editable-title
yarn add @42shadow42/react-editable-title
bun add @42shadow42/react-editable-title
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.8 |
| Published | 2020-05-16 |
| First published | 2020-05-07 |
| Weekly downloads | 0 |
| License | GPL 3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 74.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Emre Çakır, 42shadow42 |
| Maintainers | 42shadow42 |
| Keywords | react, editable, title, text, data, content, table, customizable, validation |

## Links

- npm: https://www.npmjs.com/package/@42shadow42/react-editable-title
- Repository: https://github.com/42shadow42/react-editable-title
- Homepage: https://github.com/42shadow42/react-editable-title#readme
- Issues: https://github.com/42shadow42/react-editable-title/issues
- npm.io page: https://npm.io/package/@42shadow42/react-editable-title

## Dependencies (2)

- [reactstrap](https://npm.io/package/reactstrap.md) ^8.4.1
- [react-icons](https://npm.io/package/react-icons.md) ^3.10.0

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 2.0.8 (latest) — 2020-05-16
- 2.0.7 — 2020-05-16
- 2.0.6 — 2020-05-16
- 2.0.5 — 2020-05-14
- 2.0.4 — 2020-05-12
- 2.0.3 — 2020-05-11
- 2.0.2 — 2020-05-11
- 2.0.1 — 2020-05-10
- 2.0.0 — 2020-05-10
- 1.2.8 — 2020-05-09
- 1.2.7 — 2020-05-08
- 1.2.6 — 2020-05-07
- 1.2.5 — 2020-05-07
- 1.2.4 — 2020-05-07
- 1.2.3 — 2020-05-07

## README

An editable title implementation for react.

## Installation



```
npm install react-editable-title
```

## Usage

```javascript
import React, { useState } from 'react'
import Editable from 'react-editable-title'

const App = () => {
  const [text, setText] = useState('')

  const handleTextUpdate = (current: string) => {
    setText(current)
  }

  return (
        <Editable 
          text={text} 
          placeholder="Type here"
          cb={handleTextUpdate}
         />
  )
}

```

## API

| Attribute                | Type            | Description                                                        | Required |
|--------------------------|-----------------|--------------------------------------------------------------------|----------|
| `text`                   | `string`        | Text to be displayed                                               | **Yes**  |
| `cb`                     | `function`      | Invoked when the text has been edited                              | **Yes**  |
| `onEditCancel`           | `function`      | Invoked when the edit has been canceled                            | No       |
| `onValidationFail`       | `function`      | Invoked when the text hasn't matched the regex                     | No       |
| `placeholder`            | `string`        | Placeholder text of the input element                              | No       |
| `saveOnBlur`             | `boolean`       | Attempts to save text input on unfocus. **Default** is `true`      | No       |
| `seamlessInput`          | `boolean`       | Presents text-editor alike experience. **Default** is `false`      | No       |
| `inputPattern`           | `string`        | Regex pattern of desired input                                     | No       |
| `inputErrorMessage`      | `string`        | Info message about mismatch of input                               | No       |
| `inputMinLength`         | `number`        | Min length accepted as an input                                    | No       |
| `inputMaxLength`         | `number`        | Max length accepted as an input                                    | No       |



## Features
The component can be controlled by keyboard keys. Hit **Enter** to save or **Esc** to cancel your edit.
If there is **no** change in the text, neither **Enter** nor the **Edit** button would work.

You also can control the validity of inputs with the **regex** you would provide. If the regex won't match the user input
then your desired **error message** will be shown below of the input field.

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.
Thanks :raised_hands:


## License
[GPL](https://choosealicense.com/licenses/gpl-3.0/)

---
_Source: https://npm.io/package/@42shadow42/react-editable-title · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
