المكوّنات · جدول مقارنة
جدول مقارنة
صفّ الميزة رأس، والعمود المميّز يُعلَن لا يُلوَّن فقط
12 تصاميم من هذه العائلة
<div class="tb tbc">
<div class="head"><h4 data-ar="قارن الباقات" data-en="Compare plans">قارن الباقات</h4></div>
<div class="wrap"><table>
<thead><tr>
<td></td>
<th scope="col" data-ar="مجاني" data-en="Free">مجاني</th>
<th scope="col" class="best" data-ar="احترافي" data-en="Pro">احترافي</th>
<th scope="col" data-ar="منشأة" data-en="Enterprise">منشأة</th>
</tr></thead>
<tbody></tbody>
</table></div>
</div>
/* pt-scoped */
/* table-compare — مقارنة باقات */
.tbc{width:100%;height:100%;display:flex;flex-direction:column;gap:6px;
font-size:10px;color:var(--pt-text-secondary);overflow:hidden;padding:9px 10px}
.tbc .wrap{flex:1;min-height:0;overflow:auto;border-radius:var(--pt-radius-sm);
border:1px solid var(--pt-border-subtle)}
.tbc table{width:100%;border-collapse:collapse;font-size:8.5px}
.tbc th, .tbc td{padding:5px 7px;text-align:start;white-space:nowrap}
.tbc thead th{position:sticky;inset-block-start:0;z-index:2;background:var(--pt-bg-inset);
color:var(--pt-text-muted);font-weight:500;font-size:8px;
border-bottom:1px solid var(--pt-border-default)}
.tbc tbody tr{border-bottom:1px solid var(--pt-border-subtle)}
.tbc tbody tr:last-child{border-bottom:0}
.tbc tbody tr:hover{background:var(--pt-surface-hover)}
.tbc tbody td{color:var(--pt-text-secondary)}
.tbc .e{text-align:end;font-variant-numeric:tabular-nums}
.tbc .head{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.tbc .head h4{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600}
.tbc .cnt{font-size:8px;color:var(--pt-text-muted);font-variant-numeric:tabular-nums;
margin-inline-start:auto}
.tbc button{font:inherit;cursor:pointer}
.tbc button:focus-visible, .tbc input:focus-visible, .tbc select:focus-visible, .tbc th:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:-2px}
.tbc .empty{padding:12px;text-align:center;font-size:9px;color:var(--pt-text-muted)}
/* شخصية: عمود مميّز بحدّ، رموز بدل نصّ، انحناء صغير */
.tbc th[scope=row]{color:var(--pt-text-secondary);font-weight:400;font-size:8.5px;
text-align:start;white-space:normal}
.tbc td{text-align:center}
.tbc thead th{text-align:center;color:var(--pt-text-primary);font-weight:600;font-size:9px}
.tbc .best{color:var(--pt-accent)}
.tbc td.best, .tbc thead th.best{background:var(--pt-accent-muted)}
.tbc .y{color:var(--pt-accent);font-size:10px}
.tbc .nn{color:var(--pt-text-muted);opacity:.6}
.tbc .v{font-size:8.5px;color:var(--pt-text-secondary);font-variant-numeric:tabular-nums}
.tbc tbody tr:first-child td, .tbc tbody tr:first-child th{padding-top:7px}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.tbc');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
var ar = document.documentElement.lang !== 'en';
var FEATURES = [
{ f: { ar: 'عدد المشاريع', en: 'Projects' }, v: ['3', ar ? 'بلا حدّ' : 'Unlimited', ar ? 'بلا حدّ' : 'Unlimited'] },
{ f: { ar: 'المكوّنات المفتوحة', en: 'Open components' }, v: [true, true, true] },
{ f: { ar: 'البرومبتات الجاهزة', en: 'Ready prompts' }, v: [false, true, true] },
{ f: { ar: 'القوالب الكاملة', en: 'Full templates' }, v: [false, true, true] },
{ f: { ar: 'مقاعد الفريق', en: 'Team seats' }, v: ['1', '5', ar ? 'بلا حدّ' : 'Unlimited'] },
{ f: { ar: 'دعم بأولوية', en: 'Priority support' }, v: [false, false, true] },
{ f: { ar: 'مدير حساب', en: 'Account manager' }, v: [false, false, true] }
];
/* scope=row على اسم الميزة: بدونه يسمع القارئ «نعم» مجرّدة بلا صفّ ولا عمود */
root.querySelector('tbody').innerHTML = FEATURES.map(function (r) {
return '<tr><th scope="row">' + (ar ? r.f.ar : r.f.en) + '</th>' +
r.v.map(function (v, i) {
var cls = i === 1 ? ' class="best"' : '';
if (v === true) return '<td' + cls + '><span class="y" aria-label="' +
(ar ? 'متوفّر' : 'Included') + '">✓</span></td>';
if (v === false) return '<td' + cls + '><span class="nn" aria-label="' +
(ar ? 'غير متوفّر' : 'Not included') + '">—</span></td>';
return '<td' + cls + '><span class="v">' + v + '</span></td>';
}).join('') + '</tr>';
}).join('');
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# Comparison Table
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** Comparison Table — Each feature row is a header, and the highlighted column is announced, not just coloured
**Why this component matters:** Use scope="row" on the feature names so a screen reader announces “Feature — Plan — Yes”. Without it the user hears a bare “Yes” with no idea which row or column it belongs to.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.