Skip to content
HomeCobalt

Inline edit

Lets a person change one saved value where it is shown, such as a watchlist's name or one figure in a record, and says whether the change was saved.

Examples

A watchlist's name in its page header. Press it, or Tab to it and press Enter, to rename it in place; Enter or leaving the field saves and Escape puts the old name back.

24 funds, updated daily

FailedA rename the server turns down. The box keeps the name that was not saved, on the red wash, with Not saved and Retry at its end; press the name to change it, or Escape to put the saved one back. The first save here fails.
ValidateOne figure in a record, edited where it is shown. The check refuses what is not a percentage between 0 and 100: the field stays open with the reason at its end, and leaving it keeps the words on the red wash.
Target weight, percent
In a data listA saved search's details, each value edited in place. The words line up with the labels' column, and the field's fill reaches past them, so nothing moves between reading and editing. Notes is read only.
Name
Owner
Purpose
Notes
Shared with the credit team

Usage

Use it when

  • One value on a record's page that its owner renames or corrects now and then, such as a watchlist's name in its header or one detail in a list of a saved search's details.
  • A value that saves on its own, in one request, when the person presses Enter or leaves the field.

Use something else when

  • Several values that are saved together, or are checked before they go. Use Field instead, with Input in a form and one Save.
  • A value picked from a fixed set, such as how often an alert runs. Use Select instead.
  • Text that runs to more than one line, such as a note. Use Textarea instead.
  • A number a person steps up and down, or whose bounds hold while typing. Use NumberField instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/inline-edit.json
import { InlineEdit, commitDraft, inlineEditLabels } from "@/components/cobalt/ui/inline-edit"