demo
Inline editing component for Svelte 3Features
- Simple
- Cancelable
- Different positioning of controls
edit
,save
,cancel
events
Install
npm i svelte-inline-edit --save-dev
yarn add svelte-inline-edit
CDN: UNPKG | jsDelivr (available as window.InlineEdit
)
Usage
Using events
If you are not using using es6, instead of importing add
just before closing body tag.
API
Props
Name | Type | Description | Required | Default |
---|---|---|---|---|
value |
String or Number |
Editable value | No | empty string |
options |
Array |
A list of permissible or recommended options of value | No | empty array |
rows |
Number |
Define number of rows for editable. | No | 1 |
position |
String |
Position of controls: left, right, top-left, top-right, bottom-left, bottom-right | No | right |
Slots
save
- element to be placed as save controlcancel
- element to be placed as cancel control
Events
edit
- on start editingsave
- on savecancel
- on cancel editing
You can use direct access to input element via event.detail
.
License
MIT © PaulMaly