Input - Inline edit

A non-intrusive way to adjust the value of an input in context

Healthy
Show details
Healthy
Published: May 22, 2023
Updated: September 12, 2024

Overview

In-line editing provides users with a quick, non-intrusive way to adjust the value of an input in context. In-line editing is commonly found in the header of a resource.

Inline edit components appear as a basic text element, until they are hovered—which the marketer can activate the editing mode by clicking or double-clicking on the content, which transforms into an editable input field.

Inline edit example – Hover

Design

  • The input container should flex to fill the available space of the container.
  • The full container should be clickable to trigger the editable state.
  • Pressing Enter saves the value, pressing Esc reverts the value to it’s previous state
  • In-line editing inputs always include a trailing edit icon when in inactive and hovered states. When using this pattern, the entire default state should be clickable, not just the edit pencil icon.

Sizes

  • H3: used in page headers when the page is dedicated to a specific resource (campaign, template, Journey, snippets)
  • Body: can be used in places where the inline edit input is near other inputs and forms or text of the same size.
🟢 Inline edit / State=Default, Size=H3

🟢 Inline edit / State=Default, Size=H3

🟢 Inline edit / State=Default, Size=Body 2

🟢 Inline edit / State=Default, Size=Body 2

  • H3 has a border radius of 6px / ${borderRadius.threeEights}
  • Body has a border radius of 4px / ${borderRadius.quarter}

 

States

🟢 Inline edit / State=Default, Size=H3

🟢 Inline edit / State=Default, Size=H3

🟢 Inline edit / State=Default, Size=Body 2

🟢 Inline edit / State=Default, Size=Body 2

🟢 Inline edit / State=Hover, Size=H3

🟢 Inline edit / State=Hover, Size=H3

🟢 Inline edit / State=Hover, Size=Body 2

🟢 Inline edit / State=Hover, Size=Body 2

🟢 Inline edit / State=Active, Size=H3

🟢 Inline edit / State=Active, Size=H3

🟢 Inline edit / State=Active, Size=Body 2

🟢 Inline edit / State=Active, Size=Body 2

🟢 Inline edit / State=Error, Size=H3

🟢 Inline edit / State=Error, Size=H3

🟢 Inline edit / State=Error, Size=Body 2

🟢 Inline edit / State=Error, Size=Body 2

 

Guidelines

Use cases

  • Use the Inline Edit component in interfaces where users need to quickly edit content without leaving the current page or screen.
  • Implement the component in content management systems, dashboards, or data tables where real-time editing is required.
  • If the input’s content is cleared, and the input container leaves the editable state, the content should default to the last saved value.
  • If the field has a max length set, and the string is 10 characters from the the max length, a tool tip should appear in below and justified to the right of the input indicating the limit has been reached and that they can no longer enter in any additional characters. See more in Character Limit guidelines
  • Always test for accessibility considerations, confirming that keyboard navigation and focus management is correct
  • Avoid using the Inline Edit component for complex editing tasks that require advanced functionality or validation logic
  • Don't hide critical actions or controls within the editing mode, as it may confuse users or impede usability

 

Content

  • The format of the text in the input container should inherit the styles and properties of the inactive state. For example, if the inactive state uses the H4, the H4 styling should remain as the input changes states.
  • If the name of the resource is cleared, and the input container leaves the editable state, the resource name should default to the last saved value.
  • When an item is created (campaign/journey/template), a default name is assigned with the format of [Item type] created on [Day, Month, Year] at [00:00AM/PM].

Example

Accessibility

  • Users should be able to use common keyboard shortcuts to navigate through in-line editing.
  • If the field is in an active state, pressing Enter should save the resource name and show a success toast.
  • Pressing Esc should cancel edits and revery back to its previous state.
  • Use semantic HTML elements and appropriate ARIA attributes to enhance screen reader compatibility and provide context for the Inline Edit component.
  • Ensure that keyboard navigation is supported, allowing users to activate the editing mode and make edits without relying solely on mouse interactions.

 

Health

Is documented

The component is fully documented

Accessibile

Tested against WCAG 2.1 AAA accessibility guidelines

Tokens

This component uses tokens in both Figma and code

Figma component

Includes a link to a Figma component that has been imported to Supernova

Storybook

Includes a link to an external code repository

Status

The component has a health status indicated

Healthy