# InlineField A labeled record value that is edited in place and saved on commit. Live preview of every variant and state: https://ui.usedir.com/components/inline-field ## Install ```sh npx shadcn@4.21.0 add lr-run/dir-ui/inline-field#v0.4.0 ``` [Registry item with source and dependencies](https://github.com/lr-run/dir-ui/blob/v0.4.0/registry.json) Requires React 19, Tailwind CSS 4 and shadcn initialized with Base UI: npx shadcn@4.21.0 init --base base --preset base-nova (in Vite, set up the @/* path alias in tsconfig.json and vite.config.ts first). Registry target placeholders resolve through components.json: @ui, @components, @hooks and @lib. Imports below use the conventional @/ prefix for illustration; the CLI rewrites them to your configured aliases. Shared components are installed once through registryDependencies. The installer merges shared theme rules into the stylesheet configured in components.json. Existing files are never forcibly overwritten; review CLI conflicts before accepting changes. No Dir runtime is required. ## InlineInput ```tsx import { InlineInput } from '@/components/ui/inline-field.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | string | Required | | | onValueChange | (value: string) => void \| Promise | Required | Emits the raw string. Convert to a number in the caller if needed. Rejected saves retain the draft. | | disabled | boolean | false | | | placeholder | string | Add a value | | | validate | (value: string) => string \| undefined | — | Return an error to prevent saving. | | display | ReactNode | Formatted value | Optional custom value display. | | type | 'text' \| 'email' \| 'tel' \| 'url' \| 'password' \| 'search' \| 'number' \| 'money' \| 'percent' \| 'date' \| 'datetime-local' | text | | | currency | string | USD | Currency label for type="money". | | min / max / step | number \| string / number \| string / number \| "any" | — / — / any | | | renderInput | (props: InputProps) => ReactNode | — | | Input and InlineInput share the type options and calendar picker for date/datetime-local. Selecting a calendar day updates the draft; Enter or an outside click commits it. Escape cancels. Disabled values cannot open an editor. Pending saves prevent duplicate requests. ## InlineTextarea ```tsx import { InlineTextarea } from '@/components/ui/inline-field.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | string | Required | | | onValueChange | (value: string) => void \| Promise | Required | Emits the raw string. Convert to a number in the caller if needed. Rejected saves retain the draft. | | disabled | boolean | false | | | placeholder | string | Add a value | | | validate | (value: string) => string \| undefined | — | Return an error to prevent saving. | | display | ReactNode | Formatted value | Optional custom value display. | | rows | number | 4 | | The inline counterpart of Textarea. Cmd/Ctrl+Enter or an outside click saves; Enter inserts a newline and Escape cancels. ## InlineNumber ```tsx import { InlineNumber } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | number \| null | Required | | | onValueChange | (value: number \| null) => void \| Promise | Required | Rejected saves retain the draft for retry. | | disabled | boolean | false | | | min / max / step | number / number / number \| "any" | — / — / any | | | locale | string | en-US | | ## InlineMoney ```tsx import { InlineMoney } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | number \| null | Required | | | onValueChange | (value: number \| null) => void \| Promise | Required | Rejected saves retain the draft for retry. | | disabled | boolean | false | | | min / max / step | number / number / number \| "any" | — / — / any | | | locale | string | en-US | | | currency | string | USD | | ## InlinePercent ```tsx import { InlinePercent } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | number \| null | Required | | | onValueChange | (value: number \| null) => void \| Promise | Required | Rejected saves retain the draft for retry. | | disabled | boolean | false | | | min / max / step | number / number / number \| "any" | — / — / any | | | locale | string | en-US | | Values are percentage points: 60 means 60%. ## InlineDate ```tsx import { InlineDate } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | string | Required | YYYY-MM-DD or empty string. | | onValueChange | (value: string) => void \| Promise | Required | | | disabled | boolean | false | | | locale | string | en-US | | ## InlineDateTime ```tsx import { InlineDateTime } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | string | Required | YYYY-MM-DDTHH:mm; local wall time, no implicit timezone conversion. | | onValueChange | (value: string) => void \| Promise | Required | | | disabled | boolean | false | | ## InlineSelect ```tsx import { InlineSelect } from '@/components/ui/inline-choice.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | string | Required | | | onValueChange | InlineSaveHandler | Required | | | disabled | boolean | false | | | items | Choice[] | Required | | ```ts type InlineSaveHandler = (value: T) => void | Promise type Choice = { value: string; label: string } ``` Update the parent value only after persistence succeeds; throw or reject on failure. Pending saves prevent duplicate requests. Failed saves preserve the draft and offer retry or cancel. Selecting an option saves immediately. Cancel discards the pending selection. ## InlineCombobox ```tsx import { InlineCombobox } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | value | string \| null | Required | | | onValueChange | (value: string \| null) => void \| Promise | Required | | | items | Choice[] | Required | | | label | string | Required | Accessible input name. | | selectedItems | Choice[] | [] | Supply selected labels that are absent from current search results. | | disabled / invalid | boolean | false | | | loadOptions | LoadChoices | — | Optional remote search. Honor the AbortSignal; keep this callback stable. | | debounceMs | number | 150 | | | maxVisible | number | 100 | Limit local options only. Remote results keep every explicitly loaded page visible. | | autoFocus | boolean | false | Focus the input and open its options on mount. | | modal | boolean | false | Use false for editors nested in a grid. | | renderOption / renderValue | (item: Choice) => ReactNode | — | renderValue customizes multi-value chips. | | onCreate | (query: string) => void | — | Optional create action; caller owns the workflow. | | placeholder | string | Search to select… | | | clearable | boolean | true | Single selection only. | | id / ref / onBlur / aria-describedby | Input bindings | — | Connect controlled forms through React Hook Form Controller. | ```ts type Choice = { value: string; label: string; description?: string; color?: string; avatar?: string; disabled?: boolean; keywords?: string[] } type LoadChoices = (query: string, context: { signal: AbortSignal; cursor?: string }) => Promise<{ items: Choice[]; cursor?: string }> ``` ## InlineMultiCombobox ```tsx import { InlineMultiCombobox } from '@/components/ui/inline-inputs.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | value | string[] | Required | | | onValueChange | (value: string[]) => void \| Promise | Required | | | items | Choice[] | Required | | | label | string | Required | Accessible input name. | | selectedItems | Choice[] | [] | Supply selected labels that are absent from current search results. | | disabled / invalid | boolean | false | | | loadOptions | LoadChoices | — | Optional remote search. Honor the AbortSignal; keep this callback stable. | | debounceMs | number | 150 | | | maxVisible | number | 100 | Limit local options only. Remote results keep every explicitly loaded page visible. | | autoFocus | boolean | false | Focus the input and open its options on mount. | | modal | boolean | false | Use false for editors nested in a grid. | | renderOption / renderValue | (item: Choice) => ReactNode | — | renderValue customizes multi-value chips. | | onCreate | (query: string) => void | — | Optional create action; caller owns the workflow. | | placeholder | string | Search to select… | | | clearable | boolean | true | Single selection only. | | id / ref / onBlur / aria-describedby | Input bindings | — | Connect controlled forms through React Hook Form Controller. | ```ts type Choice = { value: string; label: string; description?: string; color?: string; avatar?: string; disabled?: boolean; keywords?: string[] } type LoadChoices = (query: string, context: { signal: AbortSignal; cursor?: string }) => Promise<{ items: Choice[]; cursor?: string }> ``` ## InlineRichText ```tsx import { InlineRichText } from '@/components/ui/inline-rich-text.tsx' ``` | Prop | Type | Default / required | Notes | | --- | --- | --- | --- | | label | string | Required | | | value | { notes: string; notesDoc?: Note } | Required | | | onValueChange | InlineSaveHandler | Required | | | disabled | boolean | false | | ```ts type InlineSaveHandler = (value: T) => void | Promise import type { Note } from '@/components/ui/rich-text.tsx' type RichTextValue = { notes: string; notesDoc: Note } ``` Update the parent value only after persistence succeeds; throw or reject on failure. Pending saves prevent duplicate requests. Failed saves preserve the draft and offer retry or cancel. Use Save or Cmd/Ctrl+Enter to save and Escape to cancel.