跳到内容
栏目
Fiesta

field

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

标签、输入框、可选提示、帮助文本和错误。通用的类文本控件,带一个显式 ID。

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

最简

预览

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

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

带一条提示

预览

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

<div rst-field>
  <label rst-field-label for="f_hint">网址别名 <span rst-field-hint>(小写,不含空格)</span></label>
  <input rst-input type="text" id="f_hint" name="f_hint">
</div>

控件下方带一行帮助文字

预览

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

<div rst-field>
  <label rst-field-label for="f_help">电子邮件</label>
  <input rst-input type="email" id="f_help" name="f_help" autocomplete="email" aria-describedby="f_help-help">
  <p rst-field-help id="f_help-help">我们只会用它给你发送回复。</p>
</div>

必填

预览

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

<div rst-field>
  <label rst-field-label for="f_required">全名</label>
  <input rst-input type="text" id="f_required" name="f_required" required>
</div>

带一个错误

预览

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

<div rst-field>
  <label rst-field-label for="f_error">电子邮件</label>
  <input rst-input type="email" id="f_error" name="f_error" value="grace@" aria-invalid="true" aria-describedby="f_error-error">
  <p rst-field-error id="f_error-error" role="alert">这看起来不像电子邮件地址。</p>
</div>

窄

预览

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

<div rst-field>
  <label rst-field-label for="f_short">邮政编码</label>
  <input rst-input="short" type="text" id="f_short" name="f_short" value="D02 XY45">
</div>

主字段

预览

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

<div rst-field>
  <label rst-field-label for="f_primary">标题</label>
  <input rst-input="primary" type="text" id="f_primary" name="f_primary" value="季度董事会会议">
</div>