For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.2.0/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.2.0/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.2.0/en/components/field.md.
  • English
  • v0.2.0
  • Field

    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

    Usage

    Include CSS

    Import Tailwind and one full A3S UI style bundle.

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

    Or import only the base CSS, Field component CSS, and one style pack.

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

    Using CDN or bundler imports? See the Installation page.

    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 structure

    <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.

    Examples

    Input

    Live previewHTML · CSS · JavaScript

    Choose a unique username for your account.

    Must be at least 8 characters long.

    Textarea

    Live previewHTML · CSS · JavaScript

    Share your thoughts about our service.

    Select

    Live previewHTML · CSS · JavaScript

    Select your department or area of work.

    Slider

    Live previewHTML · CSS · JavaScript

    Set your maximum budget (up to $800).

    Fieldset

    Live previewHTML · CSS · JavaScript
    Address Information

    We need your address to deliver your order.

    Checkbox

    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.

    Radio

    Live previewHTML · CSS · JavaScript
    Subscription Plan

    Yearly and lifetime plans offer significant savings.

    Switch

    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.

    Choice card

    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 group

    Stack fields inside a group and use .field-separator to divide sections.

    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

    Responsive layout

    Use data-orientation="responsive" to stack by default and switch to horizontal in wider containers.

    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.


    Validation and errors

    Add data-invalid to .field and aria-invalid="true" to the invalid control.

    Live previewHTML · CSS · JavaScript

    RTL

    Add dir="rtl" to the field, fieldset, or an ancestor.

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

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

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