For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/form-field.md.
v0.0.57
  • 简体中文
  • FormField

    数据录入@rockshin/tao-ui

    组合标签、输入控件、说明、必填标记与错误信息。

    何时使用

    输入控件需要可访问标签和辅助或错误文本时使用 FormField。

    推荐

    • 标签简短并直接描述输入内容。
    • 错误信息同时说明问题与修复方式。

    避免

    • 不要仅用 placeholder 代替标签。

    代码演示

    基础用法

    Used for account notifications.

    TSX

    说明与错误状态

    Visible to all members.

    TSX

    语义部件

    Stored securely.

    TSX

    完整表单组合

    组合布局、字段与操作区,用原生提交展示保存结果。

    Profile

    Public workspace information

    A short introduction

    No changes saved
    TSX

    错误提示与修复

    字段错误随输入更新,label 与控件自动关联。

    TSX

    明确关联控件

    指定 htmlFor 和控件 id 可与已有表单标识对接;useId 避免多个示例冲突。

    Used for account notifications

    TSX

    API

    FormField

    属性说明类型默认值
    className节点类名string | undefined-
    style节点样式CSSProperties | undefined-