Add the Nook "Editable" component to this project, exactly as Nook ships it.
Edit a value in place with a draft, explicit save, cancel and focus return.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add editable`. It writes `components/ui/editable.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/editable.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
"use client";
import { Editable } from "@/components/ui/editable";
export default function Example() {
return
;
}
```
API
- `Editable`: Edit a value in place with a draft, explicit save, cancel and focus return.
- `label` (`string`): Visible field name.
- `value / defaultValue` (`string`): Committed value; drafts do not notify until saved.
- `onValueChange` (`(value: string) => void`): Receives the saved draft.
- `required` (`boolean`): Prevents committing a blank value.
- `disabled` (`boolean`): Prevents editing.
- `name` (`string`): Name for the hidden committed form value.
- `...props` (`React.HTMLAttributes`): Native attributes on the root, with className merged and ref forwarded.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Enter saves and Escape cancels. The edit trigger regains focus after either action.
Done when the component renders like the example in light and dark mode and the project type-checks.