Skip to content

CSS: radio-input-group

.instui-radio-input-group — Một <fieldset> radio chọn đơn, dạng thường hoặc dưới dạng công tắc phân đoạn nối.

Đặt gap của chính nó giữa các radio; nối tiếp một modifier tiện ích khoảng cách -gap-* sẽ ghi đè giá trị tích hợp đó.

Source: radio-input-group.css

Khả năng truy cập

Kết xuất một <fieldset> nguyên bản với một <legend> đặt tên cho nhóm; các radio con chia sẻ một name, nên chỉ có thể chọn một lần.

Sử dụng

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

Các ví dụ

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>

Cấu trúc

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;

Bộ sửa

Bộ sửaMô tả
.-layout-columnsBố trí các radio theo cột.
.-layout-inlineBố trí các radio theo dòng.
.-requiredĐánh dấu nhóm là bắt buộc.
.-variant-toggleBố trí các công tắc con thành một điều khiển phân đoạn (chỉ phân đoạn được chọn mới được tô đầy).

Phần tử giả

Phần tử giảMô tả
::afterHiển thị dấu hoa thị trang trí cho trường bắt buộc sau văn bản legend khi nhóm được đánh dấu là bắt buộc.

Token tiêu thụ

TokenKiểuGiá trị
--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

Các thành phần phụ

Liên quan

  • radio — Điều khiển riêng lẻ mà nhóm này thu thập.
  • form-field-group — Vỏ bọc chung để nhóm và bố trí các trường.