# Inline Edit

> Inline Edit for Settings.

A shadcn/ui block from the [@flx](https://ui.flexnative.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/flx/settings-3).

- Page, with a live preview: https://shadcn.exchange/r/flx/settings-3
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/flx/settings-3-light-a0a7876a673229fb.png
- Registry item: https://ui.flexnative.com/r/settings-3.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.flexnative.com/r/settings-3.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `lucide-react`
- Registry items: `button`, `card`, `input`, `label`, `separator`

## Files

### `registry/intents/account/settings/settings-3.tsx`

```tsx
'use client'

import { useState } from 'react'
import { Check, Pencil, X } from 'lucide-react'

import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Separator } from '@/components/ui/separator'

interface Row {
  key: string
  label: string
  value: string
}

const initialRows: Row[] = [
  { key: 'name', label: 'Full name', value: 'Ada Lovelace' },
  { key: 'email', label: 'Email', value: 'ada@acme.com' },
  { key: 'phone', label: 'Phone', value: '+1 555 0142' },
]

export function Settings3() {
  const [rows, setRows] = useState(initialRows)
  const [editing, setEditing] = useState<string | null>('')
  const [draft, setDraft] = useState('')

  function startEdit(row: Row) {
    setEditing(row.key)
    setDraft(row.value)
  }

  function save(key: string) {
    setRows((prev) =>
      prev.map((r) => (r.key === key ? { ...r, value: draft } : r)),
    )
    setEditing(null)
  }

  return (
    <Card>
      <CardHeader>
        <CardTitle>Personal info</CardTitle>
        <p className="text-muted-foreground text-sm">
          Edit one field at a time, in place.
        </p>
      </CardHeader>

      <CardContent className="flex flex-col">
        {rows.map((row, i) => (
          <div key={row.key}>
            {i > 0 && <Separator />}
            <div className="flex items-center justify-between gap-4 py-3">
              {editing === row.key ? (
                <>
                  <div className="flex flex-1 flex-col gap-1.5">
                    <Label htmlFor={`ie-${row.key}`} className="text-xs">
                      {row.label}
                    </Label>
                    <Input
                      id={`ie-${row.key}`}
                      value={draft}
                      onChange={(e) => setDraft(e.target.value)}
                      autoFocus
                    />
                  </div>
                  <div className="mt-5 flex gap-1">
                    <Button
                      size="icon"
                      variant="ghost"
                      onClick={() => setEditing(null)}
                      aria-label="Cancel"
                    >
                      <X className="size-4" />
                    </Button>
                    <Button
                      size="icon"
                      onClick={() => save(row.key)}
                      aria-label="Save"
                    >
                      <Check className="size-4" />
                    </Button>
                  </div>
                </>
              ) : (
                <>
                  <div className="flex min-w-0 flex-col">
                    <span className="text-muted-foreground text-xs">
                      {row.label}
                    </span>
                    <span className="truncate text-sm font-medium">
                      {row.value}
                    </span>
                  </div>
                  <Button
                    size="sm"
                    variant="ghost"
                    onClick={() => startEdit(row)}
                  >
                    <Pencil className="size-3.5" />
                    Edit
                  </Button>
                </>
              )}
            </div>
          </div>
        ))}
      </CardContent>
    </Card>
  )
}
```
