3.3.1 • Published 8 months ago

@tabula/ui-theme v3.3.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months 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.

3.3.1

8 months ago

3.3.0

9 months ago

3.3.0-next.0

9 months ago

3.2.2

9 months ago

3.2.3

9 months ago

3.0.0-next.0

12 months ago

2.7.0

1 year ago

2.7.2

1 year ago

2.7.1

1 year ago

3.2.1

10 months ago

3.2.0

10 months ago

3.1.1

11 months ago

3.1.0

12 months ago

2.7.3

12 months ago

3.0.0

12 months ago

3.2.0-next.0

10 months ago

2.6.0

1 year ago

2.6.0-beta.0

1 year ago

2.5.0

1 year ago

2.4.0

1 year ago

2.3.0

1 year ago

2.2.0

1 year ago

2.1.0

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago