Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-clip-path

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-clip-path

plugin for tailwindcss clip-path utilities

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.5K
decreased by-16.95%
Maintainers
1
Weekly downloads
 
Created
Source

Tailwind CSS Clip-Path

The clip-path CSS property creates a clipping region that sets what part of an element should be shown. Parts that are inside the region are shown, while those outside are hidden.

This plugin adds utilities to use clip-path properties with Tailwind CSS described on developer.mozilla.org

Installation

Add this plugin to your project:

# Install using npm
npm install --save-dev tailwind-clip-path

Add the plugin to file config

// tailwind.config.js
{
  plugins: [
    require('tailwind-clip-path'),
  ],
}

clip-path

The clip-path class

ClassProperties
clip-path-noneclip-path:none
clip-path-marginclip-path:margin-box
clip-path-paddingclip-path:padding-box
clip-path-contentclip-path:content-box
clip-path-fillclip-path:fill-box
clip-path-strokeclip-path:stroke-box
clip-path-viewclip-path:view-box
clip-path-insetclip-path:inset(100px 50px)
clip-path-circleclip-path:circle(50px at 0 100px)
clip-path-ellipseclip-path:ellipse(50px 60px at 0 10% 20%)
clip-path-polygonclip-path:polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)
clip-pathclip-path:path('M0.5,1 C0.5,1,0,0.7,0,0.3 A0.25,0.25,1,1,1,0.5,0.3 A0.25,0.25,1,1,1,1,0.3 C1,0.7,0.5,1,0.5,1 Z')
clip-path-inheritclip-path:inherit
clip-path-initialclip-path:initial
clip-path-revertclip-path:revert
clip-path-revert-layerclip-path:revert-layer
clip-path-unsetclip-path:unset

Applying conditionally

You let conditionally apply utility classes in different states using variant modifiers.

<div class="hover:clip-path-ellipse">
  <!-- ... -->
</div>

Breakpoints and media queries

You can also use variant modifiers to target media queries

<div class="md:clip-path-revert">
  <!-- ... -->
</div>

Customizing your theme

You change, add, or remove utilities by editing the theme.clipPath section of your Tailwind config.

// tailwind.config.js
{
  theme: {
    clipPath: {
        mypolygon: "polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - 1rem))",
    },
  plugins: [
    require('tailwind-clip-path'),
  ],
}

And use:

<img src="" class="clip-path-mypolygon" />

Arbitrary values

If you need to use a value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

This plugin provide arbitrary values for this clases

Classvalues
clip-path
clip-path-insetDefines an inset rectangle.
clip-path-circleDefines a circle using a radius and a position.
clip-path-ellipseDefines an ellipse using two radii and a position.
clip-path-polygonDefines a polygon using an SVG filling rule and a set of vertices.
clip-path-urlDefines a shape using an optional SVG filling rule and an SVG path definition.
<div
  class="h-20 clip-path-polygon-[0_0,_100%_0,_100%_100%,_0_calc(100%_-_1rem)]"
>
  <!-- ... -->
</div>

Keywords

FAQs

Package last updated on 19 Apr 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc