twind-simple-typography
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Tailwind Simple Typography

A simple typography plugin for Tailwind CSS.

You can set up fontFamily, fontWeight, fontSize, and lineHeight easily and quickly.

Installation

npm install twind-simple-typography
yarn add twind-simple-typography
pnpm add twind-simple-typography

Usage

1. Please prepare the font in advance for use on the web.

Example: PretendardLink

2. Add the plugin to your tailwind.config.js file:

// tailwind.config.js
module.exports = {
  ...
  plugins: [
    ...
    require('twind-simple-typography')({
        fontFamilyMap: {
            'pretendard-normal': {
                weight: 400,
                family: '"Pretendard", sans-serif',
            },
            'pretendard-bold': {
                weight: 700,
                family: '"Pretendard", sans-serif',
            },
        },
        fontSizeList: [
            80, 60, 40, 35, 30, 28, 25, 22, 20, 18, 15, 13, 12, 11, 10,
        ],
        lineHeightList: [130, 160],
    }),
  ],
}

Option interface:

type FontFamilyMap = Record<
    string,
    {
        weight: number;
        family: string;
    }
>;
type FontSizeList = number[];
type LineHeightList = number[];

interface TypographyOptions {
    fontFamilyMap?: FontFamilyMap;
    fontSizeList?: FontSizeList;
    lineHeightList?: LineHeightList;
}

3. Use the classes:

<!-- React -->
<div className="pretendard-normal-13-130">
  Hello, world!
</div>

Authors

nonameP765 - nonamep@setsuna.kr

Code

GitHub

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.19latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.19

Package Sidebar

Install

npm i twind-simple-typography

Weekly Downloads

9

Version

0.0.1

License

MIT

Unpacked Size

6.15 kB

Total Files

5

Last publish

Collaborators

  • nonamep765