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

@virtuslab/tetrisly-react

v1.8.0

Published

Tetrisly offers user-friendly components designed for effortless integration. Plus, it's fully compatible with fully compatible with Tetrisly for Figma with a seamless design and development experience in mind.

Downloads

544

Readme

Tetrisly for React

🧩 Tetrisly offers user-friendly components designed for effortless integration. Plus, it's fully compatible with Tetrisly for Figma with a seamless design and development experience in mind.

If you want to know more about Tetrisly, check out our website: tetrisly.com

Tech Stack

We've decided to use xstyled for styling our components. If you are interested in our reasoning, check out our article on this topic: Style Wars: Tailwind vs. CSS-in-JS in Design Systems Implementation

Installation

Install tetrisly-react with npm (you can do the same with yarn, pnpm or any other package manager)

  npm install @virtuslab/tetrisly-react

and dependencies:

  npm install styled-components @xstyled/styled-components

Setup

TetrislyProvider

After installing the package, you need to wrap your application in the TetrislyProvider component. This will provide the theme and other context to your application.

import { TetrislyProvider } from '@virtuslab/tetrisly-react';

function App() {
  return (
    <TetrislyProvider>
      <YourApp />
    </TetrislyProvider>
  );
}

TetrislyProvider accepts optional prop theme which can be used to override default theme.

import { TetrislyProvider } from '@virtuslab/tetrisly-react';

function App() {
  return (
    <TetrislyProvider
      theme={{
        colors: {
          '$color-semantic-brand--4': th.color('$color-raspberry--4'),
          '$color-semantic-brand--3': th.color('$color-raspberry--3'),
          '$color-semantic-brand--2': th.color('$color-raspberry--2'),
          '$color-semantic-brand--1': th.color('$color-raspberry--1'),
          '$color-semantic-brand-0': th.color('$color-raspberry-0'),
          '$color-semantic-brand-+1': th.color('$color-raspberry-+1'),
          '$color-semantic-brand-+2': th.color('$color-raspberry-+2'),
          '$color-semantic-brand-+3': th.color('$color-raspberry-+3'),
          '$color-semantic-brand-+4': th.color('$color-raspberry-+4'),
          '$color-semantic-brand-+5': th.color('$color-raspberry-+5'),
          '$color-semantic-brand-+6': th.color('$color-raspberry-+6'),
          '$color-semantic-brand-+7': th.color('$color-raspberry-+7'),
          '$color-semantic-brand-+8': th.color('$color-raspberry-+8'),
        },
      }}
    >
      <YourApp />
    </TetrislyProvider>
  );
}

Default theme

Our default theme contains all of fundamental Tetrisly Design Tokens, you can use it with xstyled props to easy set up your design. See tet.* utility example of use.

Here you can see the default theme or a complete list of theme options.

Default font

Tetrisly uses Inter font as default. To add it to your app you should link it in your root .html file:

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;450;600&display=swap"
  rel="stylesheet"
/>

tet.* utility

tet function is our extension of xstyled x.* utility. Both has the same API, but we will add some extra features in near future. You can read more here.

Example of use

import {
  TetrislyProvider,
  Button,
  theme,
  tet,
} from '@virtuslab/tetrisly-react';

const App = () => (
  <TetrislyProvider>
    <tet.div
      display="flex"
      justifyContent="center"
      alignItems="center"
      h="100vh"
    >
      <tet.div>
        <tet.h1
          textAlign="center"
          mb="$dimension-200"
          text="$typo-header-4xLarge"
          color="$color-content-primary"
        >
          Hello world!
        </tet.h1>
        <tet.div display="flex" justifyContent="center" alignItems="center">
          <a
            href="https://storybook.tetrisly.com"
            target="_blank"
            rel="noreferrer"
          >
            <Button label="Go to Storybook" appearance="primary" />
          </a>
        </tet.div>
      </tet.div>
    </tet.div>
  </TetrislyProvider>
);

export default App;

Run Locally

Clone the project

  git clone https://github.com/VirtusLab/tetrisly-react

Go to the project directory

  cd tetrisly-react

Install dependencies

  yarn install

Start the storybook server

  yarn storybook

Running Tests

To run tests, run the following command

  yarn test

Documentation

If you want to dive deeper into the components Tetrisly offers, check out our official documentation: Tetrisly Docs

You can also check out our Storybook, which is our Documentation for React components (now in progress): Tetrisly Storybook

Customization

All Tetrisly components have a custom prop. It makes it possible to customize the component without the need to create a new one. Below you can see an example of Button customization

Button

If you want to change any of button styles, you can make it by passing custom props with object based on specific component config.

For instance, to change background-color of appearance="primary" intent="secondary" variant to pink, just pass referenced object structure:

<Button
  label="Button label"
  appearance="primary"
  intent="success"
  custom={{
    default: {
      appearance: {
        primary: {
          intent: {
            success: {
              backgroundColor: 'raspberry-0', // you can also pass any color value not included in default theme
            },
          },
        },
      },
    },
  }}
/>

we are still working on it, thanks for your feedback here!

Useful links

Getting Help

If at any point you need help, feel lost, or have some feedback for us, you can create issues on our GitHub repository, or reach out to us on out Discord Server: Tetrisly Discord

Testimonials

If you want to share with us your thoughts on Tetrisly, or showcase what you have built with it (it could be any aspect of our product, not only the React library), you can do it here: Tetrisly Testimonials Form

License

We are using the Apache License 2.0 for our library of components

VirtusLab

Meet VirtusLab, the visionary team behind Tetrisly for React and the Tetrisly design system. Trusted by clients, they excel in product design, design systems and front-end engineering, creating mission-critical solutions across the product lifecycle.