Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Repository files navigation

react-bootstrap-xeditable

X-Editable for React with Bootstrap. Demo

Build Statusnpm versiondevDependencies Status

Install

# npm
npm install react-bootstrap-xeditable
# yarn
yarn add react-bootstrap-xeditable

import bootstrap css and xeditable css


<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://vitalets.github.io/x-editable/assets/x-editable/bootstrap3-editable/css/bootstrap-editable.css">

Usage:

TextField

import {EditableTextField} from 'react-bootstrap-xeditable';
<EditableTextFieldname='username' value={this.state.value}onSave={this.onSave}placeholder='Please input your username'/>

Options

OptionTypeRequiredDescription
isEditingbooleanoptionalSet editing status
isEditablebooleanoptionalYou can make it readonly
linkClassNamestringoptionalDefined the css class for the link text
nonValueTextstringoptionalthe default text if no value
valuestringrequiredThe value of input text
onSavefunctionrequiredthe callback when click save button
onCancelfunctionoptionalthe callback when click cancel button
placeholderstringoptional

Select

constoptions=[{text: 'China',value: 'CN'},{text: 'India',value: 'IN'},{text: 'United Kingdom (UK)',value: 'UK'},{text: 'United States of America (USA)',value: 'USA'}];
import {EditableSelect} from 'react-bootstrap-xeditable';
<EditableSelectname='country' onSave={this.onSave}value={this.state.value}options={options}/>

Options

OptionTypeRequiredDescription
isEditingbooleanoptionalSet editing status
isEditablebooleanoptionalYou can make it readonly
linkClassNamestringoptionalDefined the css class for the link text
nonValueTextstringoptionalthe default text if no value
valuestringstring[]required
multiplebooleanoptionalIf the select support multiple
optionsIOption[]string[]required
onSavefunctionrequiredthe callback when click save button
onCancelfunctionoptionalthe callback when click cancel button

TextArea

import {EditableTextArea} from 'react-bootstrap-xeditable';
<EditableTextAreaname='username' value={this.state.value}onSave={this.onSave}placeholder='Please input your username'/>

Options

OptionTypeRequiredDescription
isEditingbooleanoptionalSet editing status
isEditablebooleanoptionalYou can make it readonly
linkClassNamestringoptionalDefined the css class for the link text
nonValueTextstringoptionalthe default text if no value
valuestringrequiredThe value of input text
onSavefunctionrequiredthe callback when click save button
onCancelfunctionoptionalthe callback when click cancel button

Progress:

  • ✅ : Supported
  • 🏃 : In Progress
  • 💭 : Planning
ElementSupportReactXElement
textfieldEditableTextField
selectEditableSelect
textareaEditableTextArea
date💭
datetime💭
select2💭

TypeScript:

d.ts already intergrated. just import it.

Known Issues:

  1. Only support inline mode
  2. onBlur not support yet

License

Licensed under the MIT license. Copyright (C) 2018 Kun Yan

About

X-Editable for React

Topics

Resources

Contributing

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages