Skip to content

CSS: form-field-group

.instui-form-field-group — یک گروه <fieldset> با یک عنوان (legend)، چیدمان ستونی یا درون‌خطی، و فاصله‌بندی قابل پیکربندی.

فاصلهٔ بین فیلدها را gap خودش تعیین می‌کند و با مودیفایرهای -col-spacing-*/-row-spacing-* زیر قابل تنظیم است — این‌ها را به استفاده از یک مودیفایر عام فاصله‌بندی -gap-* زنجیره‌ای ترجیح دهید، چون آن مقدار داخلی را به‌طور کامل بازنویسی می‌کند.

Source: form-field-group.css

دسترس‌پذیری

یک <fieldset> بومی را با یک <legend> رندر می‌کند، بنابراین متن legend نام کل گروه را برای فناوری‌های کمکی مشخص می‌کند.

نحوه استفاده

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/form-field-group.css";

نمونه‌ها

html
<fieldset class="instui-form-field-group -layout-columns -col-spacing-medium">
  <legend>Shipping address</legend>
  <label class="instui-form-field">
    <span class="label">First name</span>
    <span class="controls"><input class="instui-text-input"></span>
  </label>
  <label class="instui-form-field">
    <span class="label">Last name</span>
    <span class="controls"><input class="instui-text-input"></span>
  </label>
  <label class="instui-form-field">
    <span class="label">City</span>
    <span class="controls"><input class="instui-text-input"></span>
  </label>
  <label class="instui-form-field">
    <span class="label">State</span>
    <span class="controls">
      <select class="instui-simple-select">
        <option>CA</option>
        <option>NY</option>
        <option>TX</option>
      </select>
    </span>
  </label>
  <div class="instui-form-field-messages">
    <span class="instui-form-field-message -type-hint">All fields are used for delivery only.</span>
  </div>
</fieldset>

ساختار

text
.instui-form-field-group.-layout-columns.-col-spacing-medium
  legend
  form-field (component)
  form-field-messages (component)
flowchart TD n0[".instui-form-field-group.-layout-columns.-col-spacing-medium"]:::cssdoc-root n1("legend"):::cssdoc-part n2(["form-field"]):::cssdoc-component n3(["form-field-messages"]):::cssdoc-component n0 --> n1 n0 --> n2 n0 --> n3 click n2 "/api/css/form-field.md" click n3 "/api/css/form-field-messages.md" classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

تعدیل‌کننده‌ها

تعدیل‌کنندهتوضیحات
.-col-spacing-largeفاصلهٔ بزرگ ستون.
.-col-spacing-mediumفاصلهٔ متوسط ستون.
.-col-spacing-noneبدون فاصلهٔ ستون.
.-col-spacing-smallفاصلهٔ کوچک ستون.
.-layout-alignedهمهٔ فیلدهای فرزند را در یک شبکهٔ مشترک تراز کن.
.-layout-columnsفیلدهای فرزند را به‌صورت ستونی بچین.
.-layout-inlineفیلدهای فرزند را در یک ردیف و به‌صورت درون‌خطی بچین.
.-requiredگروه را به‌عنوان الزامی علامت‌گذاری کن.
.-row-spacing-largeفاصلهٔ بزرگ سطر.
.-row-spacing-mediumفاصلهٔ متوسط سطر.
.-row-spacing-noneبدون فاصلهٔ سطر.
.-row-spacing-smallفاصلهٔ کوچک سطر.
.-v-align-bottomفیلدها را پایین‌تراز کن.
.-v-align-middleفیلدها را در میانه تراز کن.
.-v-align-topفیلدها را بالا‌تراز کن.

نیمه‌عناصر (Pseudo-elements)

نیمه‌عنصرتوضیحات
::afterوقتی گروه الزامی است، ستارهٔ تزئینی فیلد اجباری را بعد از متن legend رندر می‌کند.

شرایط

نوعپرس‌وجوتوضیحات
supports(grid-template-columns: subgrid)

توکن‌های مصرف‌شده

Tokenنوعمقدار
--instui-component-form-field-layout-asterisk-color<color>LightDarklight-dark(#CF1F24, #FA917F)
--instui-component-form-field-layout-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-form-field-layout-font-size<length>1rem
--instui-component-form-field-layout-font-weight<integer>400
--instui-component-form-field-layout-gap-inputs<length>0.75rem
--instui-component-form-field-layout-gap-primitives<length>0.5rem
--instui-component-form-field-layout-line-height<length>1.125rem
--instui-component-form-field-layout-text-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-spacing-space-lg<length>1rem
--instui-spacing-space-md<length>0.75rem
--instui-spacing-space-sm<length>0.5rem

پشتیبانی مرورگر

  • حالت -layout-aligned از subgridِ CSS پشت یک نگهبان @supports استفاده می‌کند؛ در محل‌هایی که subgrid پشتیبانی نمی‌شود، فیلدها به چیدمان ستونیِ خودشان بازمی‌گردند.

زیرمولفه‌ها

مرتبط

  • form-field — فیلد واحدی که این گروه تکرار می‌کند.
  • radio-input-group — گروه‌بندی ورودی‌های رادیویی تحت یک legend.