项目作者: locksten

项目描述 :
A Tailwind CSS plugin for matching border radii
高级语言: JavaScript
项目地址: git://github.com/locksten/tailwindcss-padded-radius.git
创建时间: 2020-08-04T22:12:44Z
项目社区:https://github.com/locksten/tailwindcss-padded-radius

开源协议:MIT License

下载


Tailwind CSS Pulgin for Matching Border Radii



Installation

  1. npm install tailwindcss-padded-radius

Setup

  1. // tailwind.config.js
  2. module.exports = {
  3. theme: {
  4. extend: {
  5. paddedRadius: {
  6. /* The number of spacings to generate */
  7. // numberOfSpacings: 64,
  8. /* The spacing that the other spacings are multiples of */
  9. // baseSpacing: "0.25rem",
  10. /* A spacigns object to use in place of numberOfSpacings and baseSpacing */
  11. // spacings: { '1': '0.25rem', '2': '0.5rem', '3': '0.75rem' }
  12. /* Whether negative versions should be generated */
  13. // generateNegative: false,
  14. },
  15. },
  16. },
  17. plugins: [require("tailwindcss-padded-radius")],
  18. variants: {
  19. borderRadius: ["responsive", "paddedRadius"],
  20. },
  21. };

Usage

For nested border radii to match,
the outer radius must be equal to
the inner radius plus the distance between them.
This plugin adds variants to borderRadius utilties
that let you easily tweak border radii
using the same scale that is used for padding and margin.
So if the inner div has rounded-md and m-2 and the outer div has p-3,
the outer radius should be rounded-md-5.

  1. <div class="rounded-md-5 p-3 bg-gray-700">
  2. <div class="rounded-md m-2 w-32 h-32 bg-gray-200"></div>
  3. </div>