1.0.0 • Published 1 year ago

@jgmelgares/tw-presets v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Tailwind Presets

A reusable Tailwind CSS preset package for creating customizable and consistent design systems. This package includes a Tailwind preset configuration and a CSS file with predefined variables, supporting light and dark modes.


šŸš€ Features

  • Customizable Design System: Predefined colors, utilities, and components.
  • Light & Dark Mode: Automatically adapts styles based on the active mode.
  • Reusable Components: Includes base styles for buttons, typography, and more.
  • Extendable Preset: Add your customizations easily on top of the provided configurations.

šŸ“¦ Installation

  1. Add the package to your project:

    npm install tw-presets
  2. Add the preset to your Tailwind configuration:

    const myPreset = require('tw-presets/tailwind-preset');
    
    module.exports = {
      presets: [myPreset],
      content: ['./src/**/*.{html,js,ts,jsx,tsx}'], // Adjust paths as needed
    };
  3. Import the CSS in your application (if needed):

    import 'tw-presets/styles.css';

šŸ›  Usage

Example: Light & Dark Mode Button

<html class="dark">
  <body>
    <div class="p-4">
      <button class="btn-primary">Primary Button</button>
    </div>
  </body>
</html>

Example: Custom Colors

Use the primary color defined in the preset:

<div class="bg-primary text-white p-4 rounded">
  This is a component using the primary color!
</div>

šŸ—‚ Folder Structure

tw-presets/
ā”œā”€ā”€ tailwind.config.js            # Tailwind config for local build
ā”œā”€ā”€ tailwind-preset.js            # Tailwind preset file
ā”œā”€ā”€ styles.css                    # Tailwind styles with predefined variables
ā”œā”€ā”€ package.json                  # Package metadata
└── README.md                     # Documentation

✨ Customization

Extending the Preset

You can override or extend the preset in your project:

module.exports = {
  presets: [require('tw-presets/tailwind-preset')],
  theme: {
    extend: {
      colors: {
        customColor: '#ff5733',
      },
    },
  },
};

Add Your Own Components

Define custom classes in your styles.css or Tailwind configuration:

.btn-secondary {
  @apply bg-gray-600 text-white py-2 px-4 rounded;
}

šŸ“ License

This project is licensed under the MIT License.


šŸ‘„ Contributing

Contributions are welcome! If you have ideas or find bugs, feel free to:


🌟 Acknowledgments

Thanks to the Tailwind CSS team for building such an amazing framework!


šŸ“¬ Support

If you encounter any issues or have questions, please open an issue.