Skip to content

Inline Editable is an input-based component which when focused, the text can be saved or discarded.

Overview

Inline Editable was designed to keep input borders to a minimum when not engaged. The "Save" and "Discard" controls can be disabled using the controls property.

Inline Editable must contain an Input in its default slot.

Usage

  • As a more deliberate interaction to change text than a standard Input
  • Situations where text input is not a primary function
  • A title or header for a section of content
  • Content that can have a text change after being submitted

Sample

Best practices

Below are important guidelines on using the Inline Editable component.

Correct Inline Editable headers
Do use in situations where inputs would be distracting.
Avoid Inline Editable headers
Avoid using in forms.

Accessibility

Keyboard navigation

KeyFunction
TabMoves focus in and out of the component.
Tab and ShiftMoves focus in and out of the component.
EnterWhen editingEnabled is false, enables inline editing.
SpaceWhen editingEnabled is false, enables inline editing.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
afterConfirmSpecifies a callback to be executed prior to disabling editing via the controls. When provided, the component's loading state will be handled automatically.() => Promise<void>
controlscontrolsWhen true and editingEnabled is true, displays save and cancel controls.booleanfalse
disableddisabledWhen true, prevents interaction and decreases the component's opacity.booleanfalse
editingEnabledediting-enabledWhen true, inline editing is enabled.booleanfalse
loadingloadingWhen true, a busy indicator is displayed.booleanfalse
messageOverridesOverrides individual strings used by the component.Record<string, unknown> | undefined
scalescaleSpecifies the size of the component.Scale"m"

Slots

NameDescription
default (unnamed)A slot for adding a calcite-input.

Styles

NameDescription
--calcite-inline-editable-background-color-hoverSpecifies the component's background color when hovered.
--calcite-inline-editable-background-colorSpecifies the component's background color.
--calcite-inline-editable-button-background-colorWhen appearance="solid" or appearance="outline-fill", specifies the background color of the component's button element.
--calcite-inline-editable-button-corner-radiusSpecifies the corner radius of the component's button element.
--calcite-inline-editable-button-loader-colorSpecifies the loader color of the components's button element.
--calcite-inline-editable-button-text-colorSpecifies the text color of the component's button element.

Events

NameDescriptionBehavior
calciteInlineEditableEditCancelFires when the component's "cancel editing" button is pressed.bubblescomposed
calciteInlineEditableEditConfirmFires when the component's "confirm edits" button is pressed.bubblescomposed

Methods

NameDescriptionSignature
componentOnReadyCreate a promise that resolves once component is fully loaded.componentOnReady(): Promise<this>
setFocusSets focus on the component.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.