Skip to content

Squircle

Flawless math-driven squircle masking and geometry rendering for modern UIs using CSS Houdini.

3.4 KB
•
Updated on September 12, 2026

@usespaceui/squircle brings iOS-style squircles (mathematically perfect superellipses) to your Tailwind CSS projects. It mimics the continuous curvature corners found in Figma and Apple devices. By utilizing the CSS Houdini Paint Worklet API, it provides native-like performance and seamlessly integrates with Tailwind CSS.

Features

  • 💃 Native Tailwind Integration: Use utility classes like squircle-2xl just like you would rounded-2xl. No framework-specific wrappers required.
  • ⚡️ Zero-JS Layout Thrashing: Driven by the native CSS Paint API (Houdini). Repaints happen instantly on the compositor thread.
  • ✨ Native Borders: The worklet automatically detects and renders standard Tailwind borders perfectly onto the squircle shape.
  • 🛠️ Customizable Smoothing: Adjust the smoothing intensity with modifiers (/0 to /100).

Installation

If you initialized Space UI in your project, the squircle plugin is already included! If not, you can install it manually:

Bash

Setup

Because the plugin relies on a CSS Houdini worklet to draw the shape, you must initialize the script once in your app.

1. Provider Initialization (React / Next.js)

Since the worklet interacts with the browser DOM, initialize it inside a Client Component provider.

components/providers/squircle-provider.tsx

Wrap your root layout with this provider:

app/layout.tsx

2. Tailwind CSS Configuration

For Tailwind CSS v4: Add the squircle plugin to your app.css or globals.css.

Code

For Tailwind CSS v3: Add the squircle plugin to your tailwind.config.ts.

tailwind.config.ts

Usage

You do NOT need a React component to use Squircles. Just use the squircle-* classes on standard HTML elements! The classes automatically map to your Tailwind theme's borderRadius values.

1. Sizing

Code

2. Smoothing Intensity

By default, the plugin applies a 60% smooth transition between the straight edge and the corner arc, perfectly matching native OS smoothing.

You can adjust this intensity using modifiers (/0, /20, /40, /60, /80, /100).

Code

3. Native Borders & Backgrounds (The Magic)

Unlike basic CSS masks, the Houdini worklet reads your native CSS border and background classes and draws them flawlessly.

Code

Note on border placement: By default, the plugin draws the border outside the element (like an outline or a ring) to preserve the interior space for your content. If you want the border drawn inward (standard CSS border-box behavior), you can override the custom CSS variable: <div className="squircle rounded-2xl border-4 border-red-500">...</div>

Keep in mind

  • MIT License: Free and open-source for personal and commercial use. Feel free to copy, tweak, and adapt the components to match your exact needs.
  • Credits & Inspiration: Some components on this site are inspired by or recreated from great ideas across the web. I'm not here to take credit; just to learn, experiment, and push interface craft further.
  • Reach out & Claims: If an attribution was missed, or if you have any inquiry or claim, feel free to reach out directly on X to @adrielzimbril. I'll be glad to update or resolve it right away.