Skip to content

CSS: radio-input-group

.instui-radio-input-group — วิทยุแบบเลือกได้เพียงหนึ่งตัว <fieldset> แบบธรรมดาหรือเป็นสวิตช์แบบแบ่งส่วนที่เชื่อมต่อกัน.

กำหนด gap ของตนเองระหว่างวิทยุ; การต่อกันของตัวแก้ไขระยะห่าง -gap-* จะเขียนทับค่าที่กำหนดไว้ในตัวนั้น.

Source: radio-input-group.css

การเข้าถึง

แสดง <fieldset> ดั้งเดิมพร้อม <legend> ที่ตั้งชื่อกลุ่ม; วิทยุลูกจะแชร์ name เดียวกัน ดังนั้นจะเลือกได้ทีละหนึ่ง.

การใช้งาน

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/radio-input-group.css";

ตัวอย่าง

html
<fieldset class="instui-radio-input-group">
  <legend>T-shirt size</legend>
  <label class="instui-radio"><input type="radio" name="size" checked> Small</label>
  <label class="instui-radio"><input type="radio" name="size"> Medium</label>
  <label class="instui-radio"><input type="radio" name="size"> Large</label>
</fieldset>

Toggle variant

html
<fieldset class="instui-radio-input-group -variant-toggle">
  <legend>T-shirt size</legend>
  <label class="instui-radio -variant-toggle"><input type="radio" name="size" checked> Small</label>
  <label class="instui-radio -variant-toggle"><input type="radio" name="size"> Medium</label>
  <label class="instui-radio -variant-toggle"><input type="radio" name="size"> Large</label>
</fieldset>

โครงสร้าง

text
.instui-radio-input-group.-variant-toggle
  legend
  radio (component)
    input
flowchart TD n0[".instui-radio-input-group.-variant-toggle"]:::cssdoc-root n1("legend"):::cssdoc-part n2(["radio"]):::cssdoc-component n3("input"):::cssdoc-part n0 --> n1 n2 --> n3 n0 --> n2 click n2 "/api/css/radio.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;

ตัวปรับแต่ง

ตัวปรับแต่งคำอธิบาย
.-layout-columnsจัดเรียงวิทยุในแนวคอลัมน์.
.-layout-inlineจัดเรียงวิทยุในแนวบรรทัดเดียว.
.-requiredระบุให้กลุ่มเป็นฟิลด์ที่ต้องกรอก
.-variant-toggleจัดสวิตช์ลูกเป็นการควบคุมแบบแบ่งส่วน (เฉพาะส่วนที่ถูกเลือกเท่านั้นที่เติมเต็ม).

องค์ประกอบเทียม

องค์ประกอบเทียมคำอธิบาย
::afterเรนเดอร์เครื่องหมายดอกจันแสดงฟิลด์ที่ต้องกรอกเป็นองค์ประกอบตกแต่งหลังข้อความ legend เมื่อกลุ่มถูกตั้งเป็น required

โทเค็นที่ใช้

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-md<length>0.75rem

ส่วนประกอบย่อย

ที่เกี่ยวข้อง

  • radio — ตัวควบคุมเดี่ยวที่กลุ่มนี้รวบรวม.
  • form-field-group — ตัวห่อทั่วไปสำหรับการจัดกลุ่มและจัดวางช่องข้อมูล.