For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.1.0/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.1.0/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.1.0/components/field.md.
  • 简体中文
  • v0.1.0
  • 表单字段

    Live previewHTML · CSS · JavaScript
    Payment Method

    All transactions are secure and encrypted

    Enter your 16-digit card number


    Billing Address

    The billing address associated with your payment method

    用途

    Include CSS

    导入 Tailwind 和一个完整的 A3S UI 样式包。

    @import "tailwindcss";
    @import "@a3s-lab/ui/a3s.css";

    或者只导入基本CSS、字段组件CSS和一个样式包。

    @import "tailwindcss";
    @import "@a3s-lab/ui/base.css";
    @import "@a3s-lab/ui/components/field.css";
    @import "@a3s-lab/ui/styles/a3s.css";

    使用CDN或批量程序导入?请参见安装页

    Add your field HTML

    Use class="field" for one control and class="fieldset" for related controls. Use a native <fieldset> when the group needs a <legend>; otherwise use a labelled role="group".

    <fieldset class="fieldset">
      <legend>Profile</legend>
      <p>This appears on invoices and emails.</p>
      <div role="group" aria-label="Profile fields">
        <div role="group" class="field">
          <label for="name">Full name</label>
          <input id="name" autocomplete="off" placeholder="Evil Rabbit" />
          <p>This appears on invoices and emails.</p>
        </div>
        <div role="group" class="field" data-invalid>
          <label for="username">Username</label>
          <input id="username" autocomplete="off" aria-invalid="true" aria-describedby="username-error" />
          <p id="username-error" role="alert">Choose another username.</p>
        </div>
        <div role="group" class="field" data-orientation="horizontal">
          <input id="newsletter" type="checkbox" role="switch" />
          <label for="newsletter">Subscribe to the newsletter</label>
        </div>
      </div>
    </fieldset>

    HTML 结构

    <fieldset class="fieldset">
    Native group for related fields. Use <legend> for the label and a following <p> for description.
    <div role="group" class="fieldset">
    Structural group when <fieldset> is not appropriate. Add aria-label or aria-labelledby.
    <div role="group" class="field">
    Single field wrapper. Add data-orientation when needed.
    <label>
    Label for the control. Use for when the control has an id.
    <input>, <select>, <textarea>
    Native form control. Put aria-invalid="true" on the invalid control, not only on the wrapper.
    <section>
    Optional content wrapper for label and description when the control sits beside text.
    <p>
    Helper text or error text. Use role="alert" for validation errors and connect it with aria-describedby.

    示例

    输入

    Live previewHTML · CSS · JavaScript

    Choose a unique username for your account.

    Must be at least 8 characters long.

    文本区域

    Live previewHTML · CSS · JavaScript

    Share your thoughts about our service.

    选择

    Live previewHTML · CSS · JavaScript

    Select your department or area of work.

    滑块

    Live previewHTML · CSS · JavaScript

    Set your maximum budget (up to $800).

    现场组

    Live previewHTML · CSS · JavaScript
    Address Information

    We need your address to deliver your order.

    复选框

    Live previewHTML · CSS · JavaScript
    Show these items on the desktop

    Select the items you want to show on the desktop.


    Your Desktop & Documents folders are being synced with iCloud Drive. You can access them from other devices.

    收音机

    Live previewHTML · CSS · JavaScript
    Subscription Plan

    Yearly and lifetime plans offer significant savings.

    开关

    Live previewHTML · CSS · JavaScript

    Enable multi-factor authentication. If you do not have a two-factor device, you can use a one-time code sent to your email.

    选择卡

    Wrap a .field inside a <label> to create selectable field cards. This works with radio, checkbox, and switch controls.

    Live previewHTML · CSS · JavaScript
    Compute Environment

    Select the compute environment for your cluster.

    现场组

    将字段堆叠在组内并使用 .field-separator 来划分部分。

    Live previewHTML · CSS · JavaScript
    Responses

    Get notified when ChatGPT responds to requests that take time, like research or image generation.


    Tasks

    Get notified when tasks you've created have updates. Manage tasks

    响应式布局

    默认情况下使用 data-orientation="responsive" 堆叠,并在较宽的容器中切换为水平堆叠。

    Live previewHTML · CSS · JavaScript
    Profile

    Fill in your profile information.


    Provide your full name for identification


    You can write your message here. Keep it short, preferably under 100 characters.


    验证和错误

    data-invalid 添加到 .field,将 aria-invalid="true" 添加到无效控制。

    Live previewHTML · CSS · JavaScript

    RTL

    dir="rtl" 添加到字段、字段集或祖先。

    Live previewHTML · CSS · JavaScript
    الملف الشخصي

    تظهر هذه المعلومات في حسابك.

    اكتب اسمك الأول والأخير.