@molecule/app-inline-edit-solid
Feature · inline-edit · App (browser) · v1.1.4 · Apache-2.0
Click-to-edit text + textarea + select with Save/Cancel
npm install @molecule/app-inline-edit-solidHow it works
@molecule/app-inline-edit-solid is a ready-made inline-edit feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { createSignal } from 'solid-js'
import { InlineEdit } from '@molecule/app-inline-edit-solid'
export function DealTitle() {
const [title, setTitle] = createSignal('Acme renewal')
return (
<InlineEdit
value={title()}
onSubmit={async (next) => {
setTitle(next)
}}
placeholder="Enter deal title"
/>
)
}Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid click-to-edit inline field.
Exports InlineEdit — the Solid counterpart of
@molecule/app-inline-edit-react with the same props and the same DOM: the
value rendered as text, with a click (or Tab + Enter) swapping in an
<Input> or <Textarea> plus Save/Cancel buttons. Enter submits
(Cmd/Ctrl+Enter for the textarea variant), Escape cancels.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { createSignal } from 'solid-js'
import { InlineEdit } from '@molecule/app-inline-edit-solid'
export function DealTitle() {
const [title, setTitle] = createSignal('Acme renewal')
return (
<InlineEdit
value={title()}
onSubmit={async (next) => {
setTitle(next)
}}
placeholder="Enter deal title"
/>
)
}
Type
feature
Installation
npm install @molecule/app-inline-edit-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
InlineEditProps
Props accepted by the InlineEdit component.
interface InlineEditProps {
/** Current value. */
value: string
/** Called when the user commits a new value. Return a Promise to block the UI while saving. */
onSubmit: (next: string) => void | Promise<void>
/** Render mode for the editor. */
variant?: 'input' | 'textarea'
/** Renderer for the read state — defaults to plain text. */
renderRead?: (value: string) => JSX.Element
/**
* Placeholder when value is empty. Also becomes the editor field's
* accessible label while editing; without it the field falls back to the
* translated `inlineEdit.aria.edit` default.
*/
placeholder?: string
/** Extra classes. */
className?: string
}
Functions
InlineEdit(props)
Click-to-edit text. Renders the value as text by default; on click (or
focus via tab + Enter) it swaps in an <Input> / <Textarea> for inline
editing. Enter submits, Escape cancels.
This is the Solid counterpart of @molecule/app-inline-edit-react: the
same props (React names), the same ClassMap tokens, and the same DOM for
the same input.
function InlineEdit(props: InlineEditProps): JSX.Element
props— Component props (seeInlineEditProps).
Returns: The rendered inline-edit field.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.5.0 || ^4.0.0@molecule/app-ui^1.5.0@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
-
@molecule/app-solid -
@molecule/app-ui -
@molecule/app-ui-solid -
solid-js -
Requires a bonded ClassMap (
getClassMap()throws otherwise) and@molecule/app-solid's i18n provider (useTranslation()throws without it); button labels come from the@molecule/app-locales-inline-editcompanion bond. -
Return a Promise from
onSubmitto disable the buttons while saving. IfonSubmitREJECTS, the editor stays open with the draft intact but the error is not displayed — catch and surface errors inside youronSubmit(toast, form error, etc.). -
The draft re-syncs from
valuewhenever the prop changes, including mid-edit — avoid mutatingvaluewhile the user is typing.
Translations
Translation strings are provided by @molecule/app-locales-inline-edit.