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

corners

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

corners

- [x] Use one of the preset component factories like `rounded`: `const MyButton = rounded.button` - [x] Make your own component factory with `corners`: `const dogEared = corners(chamfer, null, null, null).size(40)` - [x] CSS clip-path ensures corners are

  • 0.0.7
  • npm
  • Socket score

Version published
Weekly downloads
192
decreased by-25.29%
Maintainers
1
Weekly downloads
 
Created
Source

corners logo

Bundlephobia Types Build status NPM Version MIT License

npm i corners
yarn add corners

Create react components with angled or smooth-rounded corners.

Features

  • Use one of the preset component factories like rounded: const MyButton = rounded.button
  • Make your own component factory with corners: const dogEared = corners(chamfer, null, null, null).size(40)
  • CSS clip-path ensures corners are rendered as empty space
  • Components may be dynamically sized: a resize observer is used to detect changes to component size and update the clip-path
  • Specify the corner size when calling a factory (e.g. rounded.cornerSize(10).div)
  • Support for drop shadows (e.g. corners(round).options({shadow: {...}}).div)
  • Support for positioning elements outside of the target element

API

corners(...cornerFns).size(cornerSize)

import type { FC } from "react"
import corners, { chamfer } from "corners"

const upperLeftDogeared = corners(null, null, null, chamfer).size(20)

const DogearedDiv = upperLeftDogeared.div

const MyComponent: FC = () => (
  <DogEaredDiv style={{ background: "black" }}>
    Hello, World!
  </DogEaredDiv>
)

ArgumentTypeRequired?Description
cornerFnsMaybe<DrawCorner>[]Yes1, 2, or 4 functions that specify the corners for this factory in clockwise order
cornerSizenumberYesEquivalent to the Npx given in css border-radius

LICENSE

MIT

FAQs

Package last updated on 06 Jan 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