المكونات
مفتاح تبديل
يبدّل إعدادًا يُطبّق فورًا.
الاستخدام
أساسي
HTML
<bs:bsui-switch label="Email notifications" defaultChecked="true" />التفضيلات
تُطبّق المفاتيح التغييرات فورًا، لذا لا تحتاج قائمتها إلى زر حفظ.
HTML
<bs:bsui-stack direction="column" gap="4">
<bs:bsui-switch name="deploys" label="Deploy summaries" defaultChecked="true" />
<bs:bsui-switch name="failures" label="Build failures" defaultChecked="true" />
<bs:bsui-switch name="news" label="Product news" />
</bs:bsui-stack>للقراءة فقط ومعطّل
يُبقي المفتاح المخصص للقراءة فقط قيمته ظاهرة لكنه لا يسمح بتبديلها، بينما يبدو المفتاح المعطّل باهتًا أيضًا.
HTML
<bs:bsui-stack direction="column" gap="4">
<bs:bsui-switch label="Two factor authentication" defaultChecked="true" readOnly="true" />
<bs:bsui-switch label="Single sign-on" disabled="true" />
</bs:bsui-stack>قيم مخصصة
يمكن لحالتي التشغيل والإيقاف إرسال أي قيمة، وليس on وقيمة فارغة فقط.
Submits weekly while it is on and never while it is off.
HTML
<bs:bsui-field>
<bs:bsui-field-label text="Digest emails" />
<bs:bsui-switch name="digest" label="Send a weekly digest" checkedValue="weekly" uncheckedValue="never" defaultChecked="true" />
<bs:bsui-field-description text="Submits weekly while it is on and never while it is off." />
</bs:bsui-field>البنية
يتكوّن مفتاح تبديل من الكتل أدناه. كل كتلة منها مستقلة ولا تُعرض إلا داخل العنصر الأب.
bsui/switchbsui/switch-thumb
السمات
| السمة | النوع | افتراضي |
|---|---|---|
defaultChecked | toggle | false |
disabled | toggle | false |
readOnly | toggle | false |
required | toggle | false |
name | text | — |
checkedValue | text | on |
uncheckedValue | text | — |
label | richtext | — |
bindText | text | — |
nameAlt | text | — |
onChange | text | — |
checked | text | — |
bsui/switch-thumb
لا تقبل هذه الكتلة أي سمات.