输入框

基于 React Aria 构建的带标签的文本字段 - 前导和尾随装饰、提示文本以及带有交叉淡入淡出焦点环的必需/无效状态。

This is a hint about this input.

安装

您可以使用我们的 CLI 或手动添加此输入组件:

已支持深色模式,此 组件 会自动使用 BoardUI 的语义设计变量。 设置主题切换.

CLI 将组件源(及其内部依赖项)复制到您的项目中并安装任何所需的 npm 包。

npx boardui@latest add input

使用共享 UI 包或自定义导入别名? 配置您的安装路径 在运行 CLI 之前。复制粘贴示例使用默认导入。

尺寸

This is a hint about this input.
This is a hint about this input.

状态

This is a hint about this input.
This is a hint about this input.
This is a hint about this input.
This is a hint about this input.

错误消息

当字段无效时,errorMessage 会通过 React Aria 的错误插槽替换提示文字,并作为输入框的描述与之关联。只设置 isRequired 时,React Aria 会在提交时进行原生校验:阻止表单提交,将字段标记为无效并把焦点移到它上面,同时不显示浏览器自带的气泡提示,因此用户看到的就是这条消息。使用 validationBehavior="aria" 时,提交不会被阻止,只有在你传入 isInvalid 或 validate 返回错误时,字段才会无效。

将显示在你的个人资料中。

电话号码

This is a hint about this input.
This is a hint about this input.