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 🙏

© 2024 – Pkg Stats / Ryan Hefner

keycap

v1.0.4

Published

[![npm version](https://badge.fury.io/js/keycap.svg)](https://badge.fury.io/js/keycap) ![keycap](https://github.com/buraksakalli/keycap/assets/10114716/ea114e89-6fbc-47c6-ad87-b71046cec882)

Downloads

8

Readme

Keycap

npm version keycap

Keycap is a lightweight, customizable keyboard key (kbd) component for React. It's designed to visually represent keyboard keys in your user interface, complete with a "pressed" style to give users feedback when keys are active.

Preview

You can see a live demo here.

Features

  • Lightweight with no external dependencies.
  • Easy to use and integrate into your React projects.
  • Customizable styles for both light and dark mode.
  • Pressed key state for interactive feedback.

Installation

To install the package, use npm:

npm install keycap

or yarn:

yarn add keycap

Usage

Here is a basic example of how to use the Keycap component:

import { Keycap } from "keycap";

function App() {
  return (
    <div>
      <Keycap activeKey="A">A</Keycap>
      <Keycap activeKey="B">B</Keycap>
      <Keycap activeKey="C">C</Keycap>
      <Keycap activeKey="Meta">⌘</Keycap>
      <Keycap activeKey="Enter">↵</Keycap>
    </div>
  );
}

export default App;

Props

  • activeKey: (string) The key that the Keycap component should respond to.
  • children: (node) The content to display inside the keycap, typically a single letter or symbol.
  • className: (string) Optional. A class name to add custom styles to the keycap.

Styling

The component uses the following CSS variables for theming, which you can override in your stylesheet:

/* Light Mode */
--keycap-text-color: rgb(150, 159, 175);
--keycap-gradient: linear-gradient(
  -225deg,
  rgb(213, 219, 228) 0%,
  rgb(248, 248, 248) 100%
);
--keycap-key-shadow: inset 0 -2px 0 0 rgb(205, 205, 230), inset 0 0 1px 1px #fff,
  0 1px 2px 1px rgba(30, 35, 90, 0.4);
--keycap-key-pressed-shadow: inset 0 -2px 0 0 #cdcde6, inset 0 0 1px 1px #fff,
  0 1px 1px 0 rgba(30, 35, 90, 0.4);

/* Dark Mode */
--keycap-text-color-dark: rgb(127, 132, 151);
--keycap-gradient-dark: linear-gradient(
  -26.5deg,
  rgb(38, 39, 43) 0%,
  rgb(58, 59, 63) 100%
);
--keycap-key-shadow-dark: inset 0 -2px 0 0 rgb(28, 29, 33), inset 0 0 1px 1px
    rgb(48, 49, 53), 0 2px 2px 0 rgba(3, 4, 9, 0.3);
--keycap-key-pressed-shadow-dark: inset 0 -2px 0 0 rgb(28, 29, 33), inset 0 0
    1px 1px rgb(48, 49, 53), 0 1px 1px 0 rgba(3, 4, 9, 0.5);

You can customize these variables in your CSS to match your app's theme.

Contributing

If you have any suggestions or improvements, please submit a pull request or open an issue. Contributions are always welcome!

License

This project is licensed under the MIT License