π Tailwind CSS Corner Shape Plugin 
A modern Tailwind CSS plugin that automatically applies the new CSS corner-shape property to all rounded utilities, giving your app a contemporary iOS-like aesthetic.
β¨ Features - π¨ Auto-applies corner-shape to all rounded-* utilities - π§ Fully configurable via Tailwind theme - π¦ Zero config by default - works out of the box - π― Arbitrary values support (e.g., rounded-[20px]) - π Progressive enhancement - graceful fallback for unsupported browsers - π·οΈ TypeScript support with full type definitions - β‘ Lightweight - no runtime dependencies
π Browser Support | Browser | Version | Status | |---------|---------|--------| | Chrome | 139+ | β
Supported | | Edge | 139+ | β
Supported | | Opera | 123+ | β
Supported | | Firefox | - | β³ Coming soon | | Safari | - | β³ Coming soon |
Note: Browsers that don't support corner-shape will gracefully fall back to standard border-radius.
π¦ Installation ``bash npm install tailwindcss-corner-shapeor yarn add tailwindcss-corner-shapeor pnpm add tailwindcss-corner-shape`
π― Tailwind CSS v3 & v4 Support This plugin works with both Tailwind CSS v3 and v4 . Choose the setup that matches your Tailwind version:
$3 Use the @plugin directive in your CSS file:
`css / app/globals.css or styles/app.css / @import "tailwindcss"; @plugin "tailwindcss-corner-shape/presets/squircle";`
Available presets for v4: - squircle - iOS-style (default) - very-rounded - Soft, highly rounded - moderately-rounded - Balanced modern - slightly-rounded - Subtle smooth - round - Perfect circles - bevel - Industrial chamfer
Custom configuration for v4:
Create a wrapper file for custom options:
`javascript // corner-shape.config.js import cornerShapePlugin from 'tailwindcss-corner-shape'
export default cornerShapePlugin({ default: 'superellipse(1.7)', variants: { lg: 'squircle' } }) `
Then load it: `css @import "tailwindcss"; @plugin "./corner-shape.config.js";`
$3 Add the plugin to your tailwind.config.js:
`js import cornerShapePlugin from 'tailwindcss-corner-shape'
export default { plugins: [ cornerShapePlugin(), // That's it! π ], } `
Or use named preset exports:
`js import { squircle, round, bevel } from 'tailwindcss-corner-shape'
export default { plugins: [squircle] // Use any preset } `
---
That's it! All your existing rounded-* classes now have modern corner shapes - NO CODE CHANGES NEEDED :
`tsx {/
β¨ Auto has corner-shape! /}
{/ β¨ Auto has corner-shape! /} {/
β¨ Auto has corner-shape! /}
`
The plugin automatically reads your existing
borderRadius
theme values, so it works with any custom radius you've defined!
βοΈ Configuration (Optional)
$3 Want to use a different corner shape? Use any CSS corner-shape keyword:
`
js cornerShapePlugin({ default: 'squircle', // 'round', 'scoop', 'bevel', 'notch', 'square', 'squircle' (default) })`
Or use a custom superellipse value:
`
js cornerShapePlugin({ default: 'superellipse(1.4)', // Any numeric value })`
$3 Need more control? All options available:
`
js cornerShapePlugin({ // Default corner-shape for all rounded-* classes default: 'squircle', // Keyword or superellipse function // Different shapes for specific sizes variants: { sm: 'bevel', // rounded-sm uses bevel lg: 'squircle', // rounded-lg uses squircle xl: 'superellipse(1.6)', // rounded-xl uses custom value full: 'superellipse(2)', // rounded-full - iOS squircle! },
// Exclude specific classes from getting corner-shape exclude: ['rounded-none'], // Don't apply to these classes
// Add !important to corner-shape declarations (for conflicting styles) important: false,
// Disable the plugin entirely enabled: true, })
`
$3 | Option | Type | Default | Description | |--------|------|---------|-------------| |
default
| string
| 'squircle'
| Default corner-shape for all rounded-* classes (keyword or superellipse) | | variants
| object
| {}
| Override corner-shape for specific sizes (e.g., { full: 'notch' }
) | | exclude
| string[]
| []
| Exclude classes from corner-shape (e.g., ['rounded-full']
) | | important
| boolean
| false
| Add !important
to all corner-shape declarations | | enabled
| boolean
| true
| Enable/disable the entire plugin |
$3 CSS Keywords (recommended for simplicity):
| Keyword | Equivalent | Look | Best For | |---------|------------|------|----------| |
'square'
| superellipse(infinity)
| Square corners | Remove border-radius effect | | 'squircle'
| superellipse(2)
| iOS squircle (default) | Modern apps, iOS design | | 'round'
| superellipse(1)
| Perfect round | Standard border-radius look | | 'bevel'
| superellipse(0)
| Straight chamfer | Industrial, technical UI | | 'scoop'
| superellipse(-1)
| Concave corners | Depth effects, insets | | 'notch'
| superellipse(-infinity)
| Deep notch | Special effects |Custom Superellipse Values :
| Value | Look | Best For | |-------|------|----------| |
superellipse(3)
| Almost square | High-tech UI | | superellipse(1.5)
| Balanced modern | Contemporary design | | superellipse(1.4)
| Slightly rounded | General purpose | | superellipse(0.5)
| Soft bevel | Subtle chamfer | | superellipse(-1.5)
| Deep scoop | Pronounced concave |
π¨ Usage Examples
$3 Write
rounded-*
like you always did - corner-shape is applied automatically:
`
tsx {/ Modern cards - just use rounded-xl! /}
Beautiful Card {/ Buttons - just use rounded-full! /} Click Me
{/ Avatars - just use rounded-full! /}
{/ Custom sizes - just use rounded-[20px]! /}
Works with arbitrary values too!
`
No
corner-
utilities needed - just your regular rounded- classes with automatic modern styling! π―
π― Real-World Examples
$3
`
tsx
`
$3 Configure the plugin to use squircle for rounded-full:
`
js // tailwind.config.js cornerShapePlugin({ variants: { full: 'squircle', // or 'superellipse(2)' } })`
Then just use regular rounded-full:
`
tsx `
$3 Configure scoop as default or for specific sizes:
`
js cornerShapePlugin({ default: 'scoop', // All rounded-* use scoop // Or per-size: variants: { lg: 'scoop' } })`
`
tsx
`
$3
`
js cornerShapePlugin({ variants: { md: 'bevel', } })`
`
tsx
`
π Design Patterns
$3
`
tsx
`
$3 Configure scoop for a specific size to add depth:
`
js cornerShapePlugin({ variants: { '2xl': 'scoop' } })`
`
tsx
`
$3
`
tsx
`
π How It Works The plugin leverages Tailwind's
addUtilities
and matchUtilities
APIs to:1. Override all
rounded-*
classes to include corner-shape
2. Support arbitrary values like rounded-[20px]
3. Read your existing borderRadius
theme configuration 4. Provide graceful fallback for unsupported browsersGenerated CSS example:
`
css .rounded-lg { border-radius: var(--radius); corner-shape: squircle; / or your configured value / }.rounded-[20px] { border-radius: 20px; corner-shape: squircle; }
`
π« Disabling the Plugin To disable corner-shape:
`
js cornerShapePlugin({ enabled: false, // Disable the plugin })``
Or remove the plugin entirely from your config.
π Performance - β
No runtime cost - pure CSS - β
No JavaScript required - static utility classes - β
Tree-shakeable - unused utilities are purged - β
GPU-accelerated - hardware accelerated like border-radius
π€ Contributing Contributions are welcome! This plugin is designed to be:
- Type-safe - Full TypeScript support - Well-documented - Comprehensive inline docs - Tested - Works with all Tailwind versions 3.x+ - Maintainable - Clean, readable code
π License MIT Β© Bilal Harouchi
π Resources - MDN: corner-shape - CSS Borders and Box Decorations Module Level 4 - Tailwind CSS Plugin Documentation
π‘ Credits Inspired by Apple's iOS design system and the modern web platform's evolving capabilities.
---
Made with β€οΈ by the community