Introduction to Primer CSS
·
1 min read·
Your Name
Primer is GitHub’s design system and CSS framework. It provides a set of guidelines and components to create consistent, accessible interfaces.
What is Primer?
Primer is built around three core pillars:
- Primitives - Design tokens for colors, spacing, and typography
- CSS - Utility classes and component styles
- Components - React and ViewComponent implementations
Getting Started
Install Primer CSS via npm:
npm install @primer/cssImport the CSS in your project:
@import "@primer/css/index.scss";Utility Classes
Primer provides a comprehensive set of utility classes:
Colors
<p class="color-fg-default">Default text color</p>
<p class="color-fg-muted">Muted text color</p>
<p class="color-fg-accent">Accent text color</p>Spacing
<div class="p-3">Padding of 16px</div>
<div class="m-4">Margin of 24px</div>Flexbox
<div class="d-flex flex-items-center flex-justify-between">
<span>Left</span>
<span>Right</span>
</div>Components
Primer includes many pre-built components:
| Component | Description |
|---|---|
| Box | Container with border and padding |
| Button | Interactive button styles |
| Label | Tags and badges |
| Header | Navigation header |
Dark Mode
Primer supports dark mode through data attributes:
<html data-color-mode="auto" data-light-theme="light" data-dark-theme="dark">Resources
Start building with Primer today!
Related Posts
Sample Post 5: Lorem Ipsum
2023-11-20