Action Edit
Modules are private components that are used inside of Form and Table. They are not exported from Cascara and cannot be used independently.
A special action module, fully controled by esp-auth. Use it when you want the data to be editable. In contrast with the button module, this module renders up to 2 buttons, depending on the edit state of the parent context:
- when not in edit mode, it will render a single button with the text you pass as
editLabel
prop, clicking that button will make the edit mode kick-in - when in edit mode, it will render a button for exiting edit mode (AKA cancel) and one for accepting the changes made during edit mode (AKA saving).
All these three buttons will cause your Table or Form to emit the following onAction
events:
- edit.start when entering in edit mode
- edit.cancel when exiting the edit mode via the cancel button
- edit.save when exiting the edit mode via the save button
Using the module
Additional to the props specified in the aside table, you need to pass the module
prop, with its value set to edit.
Sandbox
Feel free to play around with the following code: