Skip to content
Back

Inline edit

Rename in place: the text becomes a field without moving, saves optimistically with a drawn check, and rolls back with Retry when the save fails.

oxyn add inline-edit
MCP
Dioxus
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Rename a project, a thread or an agent; fix a task description where it is.
  • The user wants the text to become editable without a jump and trusts the save to land or tell them it didn't.

When not to use

  • One input for every form: use Text Field instead.
  • Eight variants and five sizes, with a shimmering loading state, a progress fill, press-and-hold for destructive actions and a shortcut chip: use Button instead.
  • An assistant docked beside a page: use AI side panel instead.

Installation

Inline edit is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add inline-edit
Rust
use crate::oxyn::{InlineEdit, PRIMITIVES_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{InlineEdit, PRIMITIVES_CSS};

Usage

Dioxus · rust
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

Examples

Title

A project name.

Code
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

Body

A description that grows.

Code
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        variant: "body",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

Rollback

The save fails and rolls back.

Code
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

Suggestions

Rename suggestions (Oxyn plus).

Code
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

Conflict

The agent edits too (Oxyn plus).

Code
rsx! {
    InlineEdit {
        value: name(),
        label: "Project name",
        max: Some(40),
        on_save: move |next: String| spawn(save_name(next)),
    }
}

API reference

InlineEdit

PropTypeDefaultDescription
valuerequiredString—The saved value.
labelrequiredString—Accessible name (`Project name`).
placeholderStringDefault::default()Shown when empty.
multilineboolDefault::default()Wraps and grows.
variantString"title"`title` · `body`.
maxOption<usize>Default::default()Max characters.
suggestionsVec<String>Default::default()Oxyn plus: rename suggestions.
latency_msu32600Save latency in ms (the host's promise; 0 = instant).
failboolDefault::default()The next save fails (demo / test of the rollback).
conflictOption<String>Default::default()Oxyn plus: simulate the agent renaming it while you edit.
on_saveEventHandler<String>—Persist.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceOn the text: start editing
EnterSave (Shift+Enter breaks a line in multiline)
EscCancel and roll the text back
TabLeaving saves, like a rename

Accessibility

  • The resting text is a button named “Project name: Atlas”.
  • The field has aria-label and aria-invalid; errors are linked with aria-describedby.
  • Saving and results go to a status region; Save and Cancel are labelled.
From the spec

At rest the text is a real button whose name includes the label and value. The field has an explicit label and aria-invalid. Saving, saved and failed go to a status region; conflicts use role=alert. Save and Cancel are labelled icon buttons that keep focus in the field (mousedown prevented).

Motion & interaction

The field uses the text's own font and padding so nothing moves when editing starts. The value rolls up on a change and down on a rollback. The check draws, then fades. The pencil fades in on hover only.

Timing
TransitionDurationEasingReduced motion
Enter edit0 ms layout shift——
Value roll200 msease.outswap
Check draw240 ms, visible 1.4 sease.outdrawn
Pencil120 ms fadeease.outinstant

Responsive behaviour

  • Text wraps and reserves room at the end for Save and Cancel.
  • Multiline grows in height as it wraps; on touch a tap starts editing.
Edge cases (spec)

Long titles wrap; the end keeps room for the buttons. Whitespace-only is rejected when required. Multiline trims only trailing space. A save that resolves after another edit started is ignored by phase. Touch: tap edits; no hover pencil. RTL: the buttons sit at the inline end.

Notes for AI

  • Import InlineEdit from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: InlineEditEl in oxyn_gpui.
  • Props to set first: value, label.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI