2.6.0 • Published 28 days ago

@tabula/ui-theme v2.6.0

Weekly downloads
-
License
ISC
Repository
github
Last release
28 days ago

@tabula/ui-theme

Theme provider for the UI kit.

Installation

Use the package manager pnpm to install @tabula/ui-theme.

pnpm add @tabula/ui-theme

You can use npm or yarn too.

Usage

React

Packages provides UiTheme component which imports all required styles and provides layers and vars through context.

<UiTheme>
  <YourUiEntryPoint />
</UiTheme>

Also, it provides useUiTheme hook which allows to access to provided layers and vars.

const { layers, vars } = useUiTheme();

CSS

You can use provided layers in plain CSS or PostCSS:

@layer tbl--components {
  .selector {
    color: var(--tbl--colors--brand);
  }
}

Layers and variables have tbl-- prefix to avoid naming collisions.

You can use them in Sass too.

Sass

We provide modules for Sass too:

@use '~@tabula/ui-theme' as theme;

@layer theme.$layer--components {
  .selector {
    color: theme.$colors--brand;
  }
}

vanilla-extract

The package provides the first-citizen support of vanilla-extract:

import { style } from '@vanilla-extract/css';

import { uiLayers, uiTheme } from '@tabula/ui-theme';

export const selector = style({
  [uiLayers.components]: {
    color: uiTheme.colors.brand,
  }
});

Structure

There are two types of files, which can be used to configure theme.

The first are configuration files:

  • src/fontFaces.css.ts - defines font faces;
  • src/vars.css.ts - definitions of available CSS layers and tokens.

IMPORTANT: Do not require any modules in src/vars.css.ts. It can be a problem for tokens export to Sass.

The second are definition files:

  • src/layers.css.ts - defines global CSS layers based on the layers list;
  • src/theme.css.ts - defines global CSS variables based on tokens.

Also, we provides reboot.css.ts file which defines normalize styles.

License

This project is ISC licensed.

2.6.0

28 days ago

2.6.0-beta.0

1 month ago

2.5.0

1 month ago

2.4.0

1 month ago

2.3.0

2 months ago

2.2.0

2 months ago

2.1.0

4 months ago

2.0.4

5 months ago

2.0.3

6 months ago

2.0.2

6 months ago

2.0.1

7 months ago

2.0.0

8 months ago

1.2.0

8 months ago

1.1.0

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.4.1

9 months ago

0.4.0

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.0

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago