0.0.6 • Published 7 years ago

react-label v0.0.6

Weekly downloads
20
License
MIT
Repository
github
Last release
7 years ago

react-label

Its editable one-line label for React.js, based on "Inline Edit" UX pattern.

Intallation

npm install reacl-label

or

yarn add reacl-label

Usage

    import ReactLabel from 'react-label';

    <ReactLabel
        saveButtonText='Save and Close'
        cancelButtonText='Reject'
        onChange={ this.onChangeHandler.bind(this) }
        value={ this.state.value }
        placeholder='Enter your text..'
    />

See simple example here

Props

Parameters

NameTypeDescription
valueStringValue that shows on label and inside text input
saveButtonTextStringSave button title
cancelButtonTextStringSave button title
placeholderStringSets placeholder of text input
classNameStringClass name for main container
classNameViewPanelStringClass name for view panel (clickable text label)
classNameEditPanelStringClass name for edit panel (with text input and buttons)
classNameInputStringClass name for text input
classNameSaveButtonStringClass name for save button
classNameCancelButtonStringClass name for cancel button

Options

NameTypeDescription
disableViewBooleanWhen its parameter equals true, view label will not avaible for mouse clicking
disableEditBooleanIts parameter define text input "disable" prop
showRejectButtonBooleanShows disable button optional

Events

There are methods, whose names speak for themselves:

NameType
onChangeFunction
onFocusInputFunction
onBlurInputFunction
onSaveFunction
onCancelFunction
onEditModeEnterFunction
onViewModeEnterFunction

Custom styles

You may set class names from css-modules by these props: className, classNameViewPanel, classNameEditPanel, classNameInput, classNameSaveButton, classNameCancelButton

Also you may override css styles of react-label DOM elements (BEM):

.react-label
.react-label__panel
.react-label__panel_view
.react-label__panel_edit
.react-label__input
.react-label__button
.react-label__button_cancel
.react-label__button_save
0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago