fix(Form): support setting the name attribute#6539
Conversation
The `name` prop was reserved for nested-form state paths and the native `name` attribute was stripped, so it couldn't be set on the rendered `<form>` element (needed for e.g. Netlify Forms). It now renders as the form's `name` attribute on root forms while still acting as the state path for nested forms. Resolves #5983
name attributename attribute
📝 WalkthroughWalkthroughThis PR makes the Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
🔗 Linked issue
Resolves #5983
❓ Type of change
📚 Description
The
nameprop was reserved for nested-form state paths, and the nativenameattribute was stripped viaOmit<FormHTMLAttributes, 'name'>, so there was no way to set anameon the rendered<form>element. This blocks use cases like Netlify Forms, which require anameattribute matching aform-nameinput.nameis now typedstring(instead of nested-only) and bound explicitly to the root<form>. It still acts as the state path for nested forms (which render adiv), so the dual behaviour is preserved:<form name="...">attributeAdded
renderEachcoverage forname(plusmethod,id,class,ui, andaria-label).📝 Checklist