<p align="center">
  <a href="https://chromia.com/" rel="noopener" target="_blank"><img width="150" src="https://chromia.com/images/chromia-logo.svg" alt="Chromia logo"></a>
</p>

<h1 align="center">Chromia UI Kit</h1>

The Chromia UI KIT is a set of React components specifically designed for the Chromia ecosystem. It empowers projects
like Wallet and Block Explorer to have a consistent look and feel.

## Features

- TypeScript support
- 23+ components, 2+ hooks
- CSS-in-JS styling with [stitches](https://stitches.dev/)
- Server-side rendering support
- Tree-shaking friendly
- CommonJS and ES Module support
- Works with create-react-app, next.js, your own setup, etc.

## Installation

```bash
pnpm add @chromia/ui-kit
```

## Usage

### CSS Reset

This library comes with a CSS reset that should be used in conjunction with the UI KIT. It can be used as follows:

```tsx
import { resetStyle } from '@chromia/ui-kit';

const App = () => (
  <>
    <style dangerouslySetInnerHTML={{ __html: resetStyle }} />
    <YourApp />
  </>
);
```

### Server-side CSS

If you are using server-side rendering, you will need to import generated styles as well. This can be done as follows:

```tsx
import { getCssText } from '@chromia/ui-kit';

const App = () => (
  <>
    <style dangerouslySetInnerHTML={{ __html: getCssText() }} />
    <YourApp />
  </>
);
```

> It is recommended to put these styles in the `<head>` of your app.

### Basic example

```tsx
import { Button } from '@chromia/ui-kit';

const App = () => <Button text={"Click me"} onClick={() => alert("Clicked!")} />;
```

## Documentation

We use [Storybook](https://storybook.js.org/) to document the components.
Visit the [Chromia UI-Kit Storybook](https://chromia-ui-kit.netlify.app) to see the components in action and learn how
to use them.

## License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

## Development

See DEV.md for details on how to develop this library.

