chore: react-hook-form best practices (#44221)

## Problem

The design system documentation and examples promote an invalid usage of
react-hook-form state.

## Solution

- Fix the documentation and examples
- Update Claude skills for future components

## Out of scope

- Fix current code across the repository
This commit is contained in:
Gildas Garcia authored and GitHub committed 2026-03-26 16:24:08 +01:00
1 parent fba5a8a001
commit 5c98bb6c0f
3 files changed
+9 -5

No files matched your search

+2 -3
View File
@@ -1,5 +1,5 @@
---
description: "Studio: form patterns (page layouts + side panels) and react-hook-form conventions"
description: 'Studio: form patterns (page layouts + side panels) and react-hook-form conventions'
globs:
- apps/studio/**/*.{ts,tsx}
alwaysApply: false
@@ -29,7 +29,6 @@ Use the Design System UI pattern docs as the source of truth:
## Actions and state
- Handle dirty state (`form.formState.isDirty`) to show Cancel and to disable Save.
- Handle dirty state by destructuring `isDirty` from `formState` (`const { isDirty } = form.formState`) then use it to show Cancel and to disable Save.
- Show loading on submit buttons via `loading`.
- When submit button is outside the `<form>`, set a stable `formId` and use the button’s `form` prop.