For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.4.0/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.4.0/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.4.0/components/form.md.

表单

把相关字段、校验摘要和提交操作组织为一个可恢复的任务,并保留浏览器原生提交语义。

实时预览

用法

<form class="form">
  <label class="field"><span class="label">工作区名称</span><input class="input" name="name" value="研究" required /></label><footer><button type="submit" class="btn">保存工作区</button></footer>
</form>

契约

接口值
根选择器form.form
原生根元素<form>
状态ready, submitting, success, invalid, error, read-only
事件reset, submit
方法—

产品边界

表单负责交互结构,不负责网络请求、权限或业务校验。不要把不相关设置塞进同一表单,也不要用禁用按钮代替具体错误说明。

组件只发布可复用的交互边界。数据获取、持久化、权限、可信内容与业务实体继续由宿主产品拥有。

可访问性

错误靠近字段并可从摘要定位;提交中保留输入,失败后保持焦点上下文。所有字段都需要持久可见的标签。