GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - VirtusLab/tetrisly-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.

BranchesTags
Open more actions menu

Latest commit

 

History

144 Commits
144 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.husky
.husky
 
 
.storybook
.storybook
 
 
examples/react-vite-ts
examples/react-vite-ts
 
 
public
public
 
 
src
src
 
 
types
types
 
 
.eslintrc.cjs
.eslintrc.cjs
 
 
.gitignore
.gitignore
 
 
.prettierrc.json
.prettierrc.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
commitlint.config.cjs
commitlint.config.cjs
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.node.json
tsconfig.node.json
 
 
vite.config.ts
vite.config.ts
 
 
vitest.config.ts
vitest.config.ts
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

css-in-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

  • React 18
  • xstyled

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

  • Tetrisly Storybook
  • Tetrisly Figma Docs
  • Tetrisly Figma Preview
  • xstyled Docs

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.

About

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.

tetrisly.com

Topics

design-systemdesign-tokensfigmareactstyled-componentsxstyled

Resources

Readme
License
Activity
Custom properties

Stars

39 stars

Watchers

3 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.