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

knopf.css

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knopf.css

Modern, modular, extensible button system designed for both rapid prototyping and production-ready applications

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
124
increased by7.83%
Maintainers
1
Weekly downloads
 
Created
Source

knopf.css

Modern, modular, extensible button system designed for both rapid prototyping and production-ready applications.

Made by the folks at Frameable

Installation

Just download and include the minified stylesheet on your website.

<link rel="stylesheet" href="/knopf.min.css">

You could also link to a CDN hosted file.

<link rel="stylesheet" href="https://unpkg.com/knopf.css/knopf.min.css">

Otherwise, you can use your favorite package manager to install it as a dependency.

Install with npm

npm install knopf.css

Install with yarn

yarn add knopf.css

And then import it wherever you are importing your styles.

import 'knopf.css'

Usage

By including knopf you get a bunch of goodies out of the box; however, you should probably customize the styles to meet your design needs, and there are multiple ways of doing just that.

Override default values

All of the base values can be changed by overriding the custom properties at root:

:root {
  --knopf-hue: 164;
  --knopf-saturation: 88%;
  --knopf-luminosity: 28%;
}
<button class="knopf">
  Button
</button>

Extend via modifier

You can also create your own class that sets new values for a particular instance:

.negative {
  --knopf-hue: 356;
  --knopf-saturation: 57%;
  --knopf-luminosity: 51%;
}
<button class="knopf negative">
  Button
</button>

Leverage the cascade

As with any CSS library, you can override the base class to make it your own. This aproach still lets you take advantage of the existing properties, variables and modifiers.

.knopf.knopf {
  --knopf-raised-height: 6px;
  border-block-end-color: hsl(var(--knopf-hover-background-color));
  border-block-end-width: var(--knopf-raised-height);
  margin-block-start: calc(var(--knopf-raised-height) * -1);
}

.knopf.knopf:hover {
  --knopf-raised-height: 2px;
  border-block-end-color: hsl(var(--knopf-active-background-color));
}
<button class="knopf large wide pill">
  Button
</button>

The same logic is applicable to all of the built-in modifiers, try out the playground to check them out.

I would also suggest taking a look at the source code for the full list of customizable custom properties.

You can see the full test suite on this pen.

Contributing

Please read the contribution guidelines in order to make the contribution process easy and effective for everyone involved.

Keywords

FAQs

Package last updated on 11 Feb 2021

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