npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cornerkit/react

v1.0.1

Published

React components and hooks for iOS-style squircle corners

Readme

@cornerkit/react

npm version Bundle Size TypeScript License: MIT

React components and hooks for iOS-style squircle corners. A thin wrapper around @cornerkit/core with full TypeScript support.

Live Demo | GitHub | Core Package

Installation

npm install @cornerkit/react @cornerkit/core

Quick Start

Using the Squircle Component

import { Squircle } from '@cornerkit/react';

function App() {
  return (
    <Squircle radius={24} smoothing={0.9}>
      <p>Squircle content</p>
    </Squircle>
  );
}

Using the useSquircle Hook

import { useSquircle } from '@cornerkit/react';

function Card() {
  const squircleRef = useSquircle<HTMLDivElement>({
    radius: 20,
    smoothing: 0.8,
  });

  return <div ref={squircleRef}>Card content</div>;
}

API Reference

<Squircle> Component

Declarative component for applying squircle corners to any HTML element.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | radius | number | 20 | Corner radius in pixels | | smoothing | number | 0.8 | Curve smoothness (0.0-1.0) | | border | { width: number; color: string } | - | Optional border | | as | keyof JSX.IntrinsicElements | 'div' | HTML element to render | | children | ReactNode | - | Child content | | ref | Ref<HTMLElement> | - | Forwarded ref |

Plus all valid HTML attributes for the chosen element type.

Examples

// Basic usage
<Squircle radius={24}>Content</Squircle>

// As a button
<Squircle as="button" radius={16} onClick={handleClick}>
  Click me
</Squircle>

// With border
<Squircle
  radius={20}
  smoothing={0.9}
  border={{ width: 2, color: '#3b82f6' }}
>
  Styled content
</Squircle>

// As an input
<Squircle
  as="input"
  radius={8}
  type="text"
  placeholder="Enter text..."
/>

useSquircle() Hook

Imperative hook for applying squircle corners to a ref.

Signature

function useSquircle<T extends HTMLElement = HTMLDivElement>(
  options?: UseSquircleOptions
): RefObject<T | null>;

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | radius | number | 20 | Corner radius in pixels | | smoothing | number | 0.8 | Curve smoothness (0.0-1.0) | | border | { width: number; color: string } | - | Optional border |

Example

function MyCard() {
  const squircleRef = useSquircle<HTMLDivElement>({
    radius: 24,
    smoothing: 0.9,
    border: { width: 1, color: 'gray' },
  });

  return (
    <div ref={squircleRef} className="card">
      Card content
    </div>
  );
}

TypeScript Support

Full TypeScript support with:

  • Polymorphic as prop with proper typing
  • Generic type parameter for useSquircle
  • IntelliSense for all props and options
// TypeScript knows this is an HTMLButtonElement
<Squircle as="button" onClick={(e) => console.log(e.currentTarget)}>
  Button
</Squircle>

// Type-safe hook usage
const buttonRef = useSquircle<HTMLButtonElement>({ radius: 16 });

SSR Compatibility

Both the component and hook are SSR-compatible:

  • No DOM access during server render
  • Squircle effect applied on client hydration
  • Works with Next.js, Remix, Gatsby, etc.
// Works in Next.js App Router
export default function Page() {
  return (
    <Squircle radius={20}>
      Server-rendered content with client-side squircle
    </Squircle>
  );
}

Form Elements

Squircle works with form elements while preserving accessibility:

// Input with squircle - focus styles preserved
<Squircle
  as="input"
  radius={12}
  type="text"
  placeholder="Email"
  className="focus:outline-2 focus:outline-blue-500"
/>

// Textarea
<Squircle as="textarea" radius={16} rows={4}>
  Initial text
</Squircle>

Tip: Use outline for focus styles instead of border since the squircle uses clip-path.

Re-exports

For convenience, the package re-exports these from @cornerkit/core:

import {
  DEFAULT_CONFIG,    // { radius: 20, smoothing: 0.8 }
  RendererTier,      // Enum: NATIVE, HOUDINI, CLIPPATH, FALLBACK
} from '@cornerkit/react';

Peer Dependencies

  • react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
  • @cornerkit/core: ^1.1.0

License

MIT