Primer documentation should express the voices and contributions of different people, but for it to be useful it’s important to be consistent in tone and structure.
On this page
Please read and follow these guidelines carefully when writing documentation, so that as many people as possible can benefit from Primer.
A large proportion of readers want to find an answer that helps them complete a task, so don't waste their time with unnecessary words. That doesn't mean talking like a robot though: a sprinkling of humor is fine as long as it doesn't make the documentation harder to parse or distract from instructions.
Avoid using phrases or referencing examples that are only familiar internally at GitHub. Assume readers are either members of the public or new to GitHub.
Code examples should promote what we'd like to see used in production. People copy and paste code examples as a starting point for building interfaces, and/or reference the guidelines for examples of correct implementation. While examples might be simpler than what we'd use in production, the code should promote best practices and follow our principles and accessibility standards.
Primer documentation is primarily aimed at GitHub designers and engineers at various levels of experience, but folks in other areas will also benefit from and use the guidelines.
In design docs, assume the reader knows basic design concepts and principles, such as the need for consistency, and terms such as “white space” or “scale”.
When referring to GitHub-specific terminology, link to a glossary of terms, or another document where the reader can learn more.
When referring to terms and ideas the reader may want to know more about, link to authoritative sources, such as MDN and the W3C.
In non-engineering docs, use code examples as necessary to ensure consistency and appropriate usage, but don't assume expertise in any programming language.
Don’t:
Don’t assume the reader knows about internal GitHub terminology.
If mentioning or referring to other styles and documentation, always link to the source.
Reference an existing guide by linking to it, rather than duplicating the content. However, if this makes the documentation harder to follow, consider providing that reference in the document itself (for example: spacing scale, abbreviations).
The description appears directly under the title of the component. It may be automatically pulled from component-metadata, and can be edited as needed.
What is this component, and how would you describe it to someone who has never used it before? This description should be concise and shouldn't include usage information, which is covered below this section.
Describe the elements that make up the component, including typography, spacing, and styles. This can also include sub components, if there are any. See Action list as an example.
If there are specific behaviors or interactions that the consumer of this documentation should be aware of, it's important to document here. Is it clickable, or static, and does it have any specific interactions based on state? Are there multiple types of behavior, and when does each get applied? See Autocomplete as an example.
Any component-specific accessibility considerations should be documented. This could include keyboard navigation, touch targets, and any specific usage guidelines with regards to assistive technology. See Segmented control.