mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
1.3 KiB
1.3 KiB
description, globs, alwaysApply
| description | globs | alwaysApply | |
|---|---|---|---|
| Studio: form patterns (page layouts + side panels) and react-hook-form conventions |
|
false |
Studio forms
Use the Design System UI pattern docs as the source of truth:
- Documentation:
apps/design-system/content/docs/ui-patterns/forms.mdx - Demos:
apps/design-system/registry/default/example/form-patterns-pagelayout.tsxapps/design-system/registry/default/example/form-patterns-sidepanel.tsx
Requirements
- Build forms with
react-hook-form+zod. - Use
FormItemLayoutinstead of manually composingFormItem/FormLabel/FormMessage/FormDescription. - Wrap inputs with
FormControl_Shadcn_. - Use
_Shadcn_imports fromuifor form primitives where available.
Layout selection
- Page layouts:
FormItemLayout layout="flex-row-reverse"insideCard(CardContentper field;CardFooterfor actions). - Side panels (wide):
FormItemLayout layout="horizontal"insideSheetSection. - Side panels (narrow,
size="sm"or below):FormItemLayout layout="vertical".
Actions and state
- Handle dirty state (
form.formState.isDirty) to show Cancel and to disable Save. - Show loading on submit buttons via
loading. - When submit button is outside the
<form>, set a stableformIdand use the button’sformprop.