Use for inline editing of data that is normally displayed as read-only.
You can use q2-editable field with q2-section to provide an editable header, which can be convenient if you are needing to enable a user to change category or group names.
Some Section Content
<q2-section collapsible>
<h2 class="mrg(0)" slot="q2-section-header">
<q2-editable-field
label="Edit Section Header"
value="Editable Section Header"
class="block"
hide-label
truncated
>
</q2-editable-field>
</h2>
<p>
Some Section Content
</p>
</q2-section>
It is recommended developers use the input event to validate user input for q2-editable-field.
If a developer uses the change event to validate user input, a couple considerations need to be made:
addEventListener(): The developer's change event listener will run first, then the component's internal change handler will run.onchange attribute: The component's internal change handler will not run, only the developer's onchange listener will control the change event effects.The q2-editable-field element has one or more properties that support text localization. Those properties are indicated by the localizable badge in the description.
blockIf true, component expands to fill the width of its parent element.
disabledDisables the edit button and field.
editingControls the edit state of the element.
errorsDetermines the errors applied to the q2-input element.
See q2-input for more information.
formatModifierformat-modifierDetermines the formatModifier applied to the q2-input element.
Only applicable when type="currency".
See q2-input for more information.
hideLabelhide-labelHide's the field's <label> element from view.
hintsDetermines the hints applied to the q2-input element.
See q2-input for more information.
labelThe visible descriptor for the element.
Serves as the input label while in the edit state and as a decorative label for the read state when persistentLabel is true.
maxlengthDetermines the maxLength applied to the q2-input.
See q2-input for more information.
persistentLabelpersistent-labelDisplays the provided label in the read state.
truncatedShortens long values with ellipses instead of splitting into multiple lines.
typeDetermines the type applied to the q2-input element.
See q2-input for all type values.
valueServes as the visible text while in the read state, and the default value of the input while in the edit state.
The q2-editable-field element exposes events that can be used to send and receive data from the component based on user interaction.
Emitted when the 'Edit', 'Cancel', or 'Save' buttons are clicked.
The event detail will not include a value or formattedValue if the event name is 'edit' or 'cancel'.
{ editing: boolean; name: "cancel" | "edit" | "save"; value?: string; formattedValue?: string; }Emitted when the user updates the q2-input element in the editing state.
{ formattedValue: string; value: string; }Emitted when the 'Edit', 'Cancel', or 'Save' buttons are clicked.
The event detail will not include a value or formattedValue if the event name is 'edit' or 'cancel'.
{ editing: boolean; name: "cancel" | "edit" | "save"; value?: string; formattedValue?: string; }Emitted when the user updates the q2-input element in the editing state.
{ formattedValue: string; value: string; }The q2-editable-field element exposes methods that can be used to perform various actions on the component.
Emulates clicking the cancel button, which will hide the <q2-input> field.
clickCancel() => Promise<void>Emulates clicking the edit button, which will display the <q2-input> field.
clickEdit() => Promise<void>Emulates clicking the save button, saving value in the <q2-input> field, and emitting a change event.
clickSave() => Promise<void>Emulates clicking the edit button, and setting the value of the <q2-input> field.
If the clickSave argument is true (default), the save button will be clicked after the value is set, and a
change event will be emitted.
setValue(value: string, options?: { clickSave?: boolean; }) => Promise<void>The following CSS variables are available to override the default theme styles of the q2-editable-field component.
Many Tecton components consume other components to maintain visual and functional consistency. If you are looking for a CSS variable you think should exist but are not seeing it, it may be defined in one of the dependent components below. Either way, if you think it's something we should expose more conveniently, let us know!