Settings: Add item to list with just "a single inline text field"

The docs for the declarative settings API contain the following sentence:

When new entries need a multi-field input or validation beyond a single inline text field, open a Modal from addItem.action.

(/Plugins/User+interface/Settings#Lists+with+a+form+modal (I can’t include links))

That sounds to me like there is a simple way to add a new item without a modal, if the only thing I need is “a single inline text field”. I sadly couldn’t find one. Did I miss something? Is it still wip?

You need to modify the CSS heavily and design in-memory user input persistence to achieve exact “a list item with an inline input”.

You need to:

  1. Override Obsidian CSS to make .setting-item-control take full width.
  2. Save user edits in-memory that don’t die when the list re-renders.
  3. On list re-render, obtain in-memory user drafts and set the value of the input.

If you prefer simplicity, a modal is the officially recommended approach even for a single input field.

Modal it is then. Thank you for your input.

This is a good point and something that should be revised in the docs.

It sounds like you’ve reached this conclusion already but, just to close the loop here:

Using addItem to present a modal is likely the best user experience, even for single input fields. It you space to add descriptive help text and show inline validation and adapts well on desktop and mobile.