Lesson 9 / الدرس 9

Documentation people actually read / توثيق يقرؤه الناس فعلًا

Most design system documentation is written to be complete and read by nobody. The version that gets used answers one question — "can I use this here?" — in the ten seconds someone has before they give up and build their own.

معظم توثيق أنظمة التصميم يُكتب ليكون شاملًا ولا يقرؤه أحد. أما النسخة التي تُستخدم فتجيب عن سؤال واحد — «أأستطيع استخدام هذا هنا؟» — في العشر ثوانٍ التي يملكها أحدهم قبل أن ييأس ويبني واحدًا خاصًا به.

Somebody is mid-task with a deadline. They think there might be a component for this. They have about ten seconds of patience before building their own is faster. Every decision about documentation should be made for that person, not for the imaginary reader who sits down to study the system.

What each component page needs

  1. What it is for, in one sentence, at the very top. Most visits end here, and that is a success rather than a failure.
  2. When to use something else. The single most valuable line on the page, and the one almost every system omits.
  3. A live example you can copy. Not a screenshot — something that can be taken and pasted, because that is what the person is there to do.
  4. The states, visible together. One row, labelled, so nobody has to guess what focus looks like.
  5. Accessibility notes, where the component has requirements a developer would not guess — a label, a role, a keyboard behaviour.
<div style="font-family:system-ui; max-width:420px; font-size:14px; line-height:1.6">
  <h2 style="margin:0 0 4px">Button</h2>
  <p style="margin:0 0 12px">Triggers an action on the current page.</p>

  <p style="margin:0 0 12px; padding:10px 12px; background:#fdf5e6;
            border-inline-start:3px solid #cb9432">
    <strong>Use a link instead</strong> when it navigates somewhere. If the
    browser back button should return from it, it is a link.</p>

  <p style="margin:0 0 4px"><strong>Variants</strong></p>
  <p style="margin:0 0 12px; color:#5b6478">primary &mdash; the main action, one per screen<br>
     secondary &mdash; an alternative to the primary<br>
     danger &mdash; destructive and irreversible</p>

  <p style="margin:0 0 4px"><strong>Accessibility</strong></p>
  <p style="margin:0; color:#5b6478">Needs a visible focus state. If the label is
     an icon only, it needs an accessible name.</p>
</div>
Short enough to read in ten seconds, and the highlighted line is the one carrying the most weight. "Use a link instead when it navigates" prevents a whole category of misuse that no amount of describing the button ever would.

Documentation rots

A page describing how a component behaved a year ago is worse than no page, because it is trusted. The only documentation that stays true is documentation rendered from the thing itself — a live example that breaks when the component breaks, rather than a screenshot that keeps showing last year's design forever. Where you must write prose, keep it to the parts that change least: what it is for, and when not to use it.

Try it live / جرّب بنفسك

Preview / المعاينة

Check yourself / اختبر نفسك

1. Who should component documentation be written for?

2. Which line prevents the most misuse?

3. Why is a screenshot poor documentation for a component?

Your task / مهمتك

Write the documentation page for one component you designed earlier in this course. It must be readable in ten seconds, and the "use something else when" line must sit directly under the description.

اكتب صفحة توثيق لمكوّن واحد صمّمته سابقًا في هذه الدورة. ويجب أن تُقرأ في عشر ثوانٍ، وأن يقع سطر «استخدم غيره حين» تحت الوصف مباشرة.

  • One sentence saying what it is for, at the top جملة واحدة تقول غرضه، في الأعلى
  • A "use something else when" line, naming the alternative سطر «استخدم غيره حين»، يسمّي البديل
  • A live example, and the states shown together and labelled مثال حيّ، والحالات معروضة معًا ومعنونة
  • Accessibility notes for anything a developer would not guess ملاحظات إتاحة وصول لكل ما لا يخمّنه مطوّر
How do you want to submit? / كيف تريد التسليم؟