API reference: @salmonui/editors/inline-edit
InlineEditPropsinterface
import type { InlineEditProps } from '@salmonui/editors/inline-edit';interface InlineEditProps<T = string> extends RootProps {
readonly value?: T | undefined;
readonly defaultValue?: T | undefined;
readonly save?: ((value: T, options: {
readonly signal: AbortSignal;
}) => void | PromiseLike<void>) | undefined;
readonly mode?: 'inline' | 'popover' | undefined;
readonly trigger?: 'click' | 'doubleClick' | 'editButton' | undefined;
readonly blurAction?: 'save' | 'cancel' | 'keep' | undefined;
readonly saveOnEnter?: boolean | undefined;
readonly showActions?: boolean | undefined;
readonly renderActions?: ((context: InlineEditActionsContext) => ReactNode) | undefined;
readonly validation?: InlineEditValidation<T> | undefined;
readonly placeholder?: ReactNode;
readonly renderPreview?: ((context: {
readonly value: T;
readonly placeholder: ReactNode;
}) => ReactNode) | undefined;
readonly label?: string | undefined;
readonly editing?: boolean | undefined;
readonly defaultEditing?: boolean | undefined;
readonly onEditingChange?: ((editing: boolean, event: InlineEditEditingChangeEvent) => void) | undefined;
readonly disabled?: boolean | undefined;
readonly name?: string | undefined;
readonly popoverProps?: {
readonly placement?: Placement | undefined;
readonly offset?: number | undefined;
} | undefined;
readonly localeText?: Partial<InlineEditLocaleText> | undefined;
readonly className?: string | undefined;
readonly style?: CSSProperties | undefined;
readonly classNames?: Partial<Record<InlineEditPart, string>> | undefined;
readonly styles?: Partial<Record<InlineEditPart, CSSProperties>> | undefined;
readonly ref?: Ref<InlineEditApi> | undefined;
readonly children?: ((context: InlineEditRenderContext<T>) => ReactNode) | undefined;
readonly onBeforeEditStart?: ((event: InlineEditStartEvent & InlineEditCancellable) => void) | undefined;
readonly onEditStart?: ((event: InlineEditStartEvent) => void) | undefined;
readonly onBeforeSave?: ((event: InlineEditSaveEvent<T> & InlineEditCancellable) => void) | undefined;
readonly onSave?: ((event: InlineEditSaveEvent<T>) => void) | undefined;
readonly onSaveError?: ((event: InlineEditSaveErrorEvent<T>) => void) | undefined;
readonly onBeforeEditCancel?: ((event: InlineEditCancelEvent<T> & InlineEditCancellable) => void) | undefined;
readonly onEditCancel?: ((event: InlineEditCancelEvent<T>) => void) | undefined;
readonly onDraftChange?: ((event: InlineEditDraftChangeEvent<T>) => void) | undefined;
}
| Name | Signature | Description |
|---|---|---|
valueoptional | readonly value?: T | undefined; | Saved value (controlled). |
defaultValueoptional | readonly defaultValue?: T | undefined; | Initial saved value when uncontrolled. Default |
saveoptional | readonly save?: ((value: T, options: {
readonly signal: AbortSignal;
}) => void | PromiseLike<void>) | undefined; | Persists a value. May return a promise: pending state, abort on cancel or unmount, rejection keeps editing. |
modeoptional | readonly mode?: 'inline' | 'popover' | undefined; |
|
triggeroptional | readonly trigger?: 'click' | 'doubleClick' | 'editButton' | undefined; | What starts editing. Default |
blurActionoptional | readonly blurAction?: 'save' | 'cancel' | 'keep' | undefined; | What focus leaving the editor does. Default |
saveOnEnteroptional | readonly saveOnEnter?: boolean | undefined; | Enter saves (Mod+Enter in a textarea). Default true. |
showActionsoptional | readonly showActions?: boolean | undefined; | Shows the Save and Cancel buttons. Default true. |
renderActionsoptional | readonly renderActions?: ((context: InlineEditActionsContext) => ReactNode) | undefined; | Replaces the default actions. |
validationoptional | readonly validation?: InlineEditValidation<T> | undefined; | |
placeholderoptional | readonly placeholder?: ReactNode; | Shown when the value is empty. Default |
renderPreviewoptional | readonly renderPreview?: ((context: {
readonly value: T;
readonly placeholder: ReactNode;
}) => ReactNode) | undefined; | Display state content. Default |
labeloptional | readonly label?: string | undefined; | Field label: the accessible name of the preview and the editor. |
editingoptional | readonly editing?: boolean | undefined; | Editing state. |
defaultEditingoptional | readonly defaultEditing?: boolean | undefined; | |
onEditingChangeoptional | readonly onEditingChange?: ((editing: boolean, event: InlineEditEditingChangeEvent) => void) | undefined; | |
disabledoptional | readonly disabled?: boolean | undefined; | |
nameoptional | readonly name?: string | undefined; | Form field name: a hidden input carries the saved value. |
popoverPropsoptional | readonly popoverProps?: {
readonly placement?: Placement | undefined;
readonly offset?: number | undefined;
} | undefined; | Popover placement and offset. |
localeTextoptional | readonly localeText?: Partial<InlineEditLocaleText> | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
classNamesoptional | readonly classNames?: Partial<Record<InlineEditPart, string>> | undefined; | |
stylesoptional | readonly styles?: Partial<Record<InlineEditPart, CSSProperties>> | undefined; | |
refoptional | readonly ref?: Ref<InlineEditApi> | undefined; | |
childrenoptional | readonly children?: ((context: InlineEditRenderContext<T>) => ReactNode) | undefined; | The edit element. Default: a text input. |
onBeforeEditStartoptional | readonly onBeforeEditStart?: ((event: InlineEditStartEvent & InlineEditCancellable) => void) | undefined; | |
onEditStartoptional | readonly onEditStart?: ((event: InlineEditStartEvent) => void) | undefined; | |
onBeforeSaveoptional | readonly onBeforeSave?: ((event: InlineEditSaveEvent<T> & InlineEditCancellable) => void) | undefined; | |
onSaveoptional | readonly onSave?: ((event: InlineEditSaveEvent<T>) => void) | undefined; | |
onSaveErroroptional | readonly onSaveError?: ((event: InlineEditSaveErrorEvent<T>) => void) | undefined; | |
onBeforeEditCanceloptional | readonly onBeforeEditCancel?: ((event: InlineEditCancelEvent<T> & InlineEditCancellable) => void) | undefined; | |
onEditCanceloptional | readonly onEditCancel?: ((event: InlineEditCancelEvent<T>) => void) | undefined; | |
onDraftChangeoptional | readonly onDraftChange?: ((event: InlineEditDraftChangeEvent<T>) => void) | undefined; |