跳到内容
栏目
Fiesta

field-text

表单 人会在里面打字的字段,处于真实表单会让它们出现的状态。每一个都放在带内边距的 rst-box 里,因为表单就放在这样的卡片里。

一个带标签的文本输入框。必填标记的星号是 aria-hidden,输入框的 required 属性才是程序可读的信号。

每个示例都能真实操作,但其中的链接不会跳转到任何地方。 HTML 显示可复制的标记。

最简

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="ft_bare">标题</label>
  <input rst-input id="ft_bare" name="ft_bare" type="text">
</div>

带一条提示

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="ft_hint">大标题</label>
  <input rst-input id="ft_hint" name="ft_hint" type="text" aria-describedby="ft_hint-hint">
  <small rst-field-hint id="ft_hint-hint">显示在列表中。</small>
</div>

必填

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="ft_required">显示名称 <span rst-field-required aria-hidden="true">*</span></label>
  <input rst-input id="ft_required" name="ft_required" type="text" autocomplete="nickname" required>
</div>

带一个错误

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="ft_error">标题</label>
  <input rst-input id="ft_error" name="ft_error" type="text" value="发布说明" aria-invalid="true" aria-describedby="ft_error-error">
  <small rst-field-error id="ft_error-error">已有同名标题的文章。</small>
</div>

主字段

给表单的主字段(例如标题或名称)加上 rst-input="primary",输入框会更醒目。

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="ft_primary">这是什么?</label>
  <input rst-input="primary" id="ft_primary" name="ft_primary" type="text" value="季度董事会会议">
</div>