Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@githubnext/primer-tailwind-plugin

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@githubnext/primer-tailwind-plugin

A Tailwind CSS plugin that creates utility classes for Primer Primitives.

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
0
Created
Source

@githubnext/primer-tailwind-plugin

A Tailwind CSS plugin that creates utility classes for Primer Primitives. Intended for use in GitHub Next prototypes.

[!WARNING] This is not an official GitHub Primer package.

Installation

  • Install the plugin:

    npm install -D @githubnext/primer-tailwind-plugin
    
  • Install the peer dependencies if they're not already installed:

    npm install -D tailwindcss
    npm install @primer/primitives
    
  • Add the plugin to your tailwind.config.js file:

    /** @type {import('tailwindcss').Config} */
    module.exports = {
      theme: {
        // ...
      },
      plugins: [
        require('@githubnext/primer-tailwind-plugin'),
        // ...
      ],
    }
    
  • Import the CSS variables:

    /* globals.css */
    @import "@githubnext/primer-tailwind-plugin/primitives.css";
    
  • Add the following attributes to your root html element:

    <html
      data-color-mode="auto" <!-- "auto" or "light" or "dark" -->
      data-light-theme="light"
      data-dark-theme="dark"
    >
      ...
    </html>
    

Usage examples

Color

<div class="text-fgColor-default bg-bgColor-default border border-borderColor-default">

Reference

Box shadow

<div class="shadow-resting-small">

Reference

Typography

<div class="text-body-medium">

Reference

Border radius

<div class="rounded-medium">

Reference

Guidelines

Prefer using these utility classes over the sx prop from Primer React, which is less performant and no longer recommended by the Primer team.

❌ Don't

<Box sx={{ bg: 'canvas.muted' }}>

✅ Do

<div className="bg-bgColor-muted">

FAQs

Package last updated on 29 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts