An open API service indexing awesome lists of open source software.

https://github.com/patrickap/twin-ui

Accessible react component library written in typescript ✌️.
https://github.com/patrickap/twin-ui

accessible component interface layout library react typescript ui

Last synced: 4 months ago
JSON representation

Accessible react component library written in typescript ✌️.

Awesome Lists containing this project

README

          

# twin-ui

Accessible React components for creating beautiful UIs. Built with Tailwind CSS, Radix UI, TypeScript, and React, this library provides simple, lightweight and easy-to-use components for building stunning UIs that are both beautiful and accessible.

Furthermore, it comes with pre-configured animations and offers pre-designed components, layouts, and pages, making it an ideal choice for getting your project up and running quickly.

## Images


button-preview-1
button-preview-2
checkbox-preview-1
tooltip-preview-1
input-preview-1
sign-in-preview-1
toasts-preview-1
dropdown-preview-1
dialog-preview-1

## Installation

To use `twin-ui`, install the package via npm.

```bash
npm install twin-ui

# or install a specific version
npm install twin-ui@x.x.x
```

Import the styles in your `index.css`.

```css
@import "twin-ui";
```

## Examples

**Button**

```jsx
import { Button } from 'twin-ui';

const Component = () => (
{...}}>
Click

);
```

**Dialog**

```jsx
import { Dialogs, useDialog } from 'twin-ui';

const Component = () => {
const dialog = useDialog();

return (
dialog.open({...}))}>
Click

);
};

const App = () => {
return (
<>


>
);
}
```

**Center Layout**

```jsx
import { CenterLayout } from 'twin-ui';

const Component = () => (

Centered


);
```

## Customization

This component library is built with Tailwind CSS and supports full customization through CSS variables. You can override theme values globally using either the Tailwind specific `@theme` directive or the CSS `:root` selector in your `index.css`.

**Note**: [Theme variables](https://tailwindcss.com/docs/theme) aren't just CSS variables — they also instruct Tailwind to create new utility classes that you can use in your HTML.

```css
/* Using the @theme directive */
@theme {
--color-primary-50: #eef2ff;
--color-primary-100: #e0e7ff;
--color-primary-200: #c7d2fe;
--color-primary-300: #a5b4fc;
--color-primary-400: #818cf8;
--color-primary-500: #6366f1;
--color-primary-600: #4f46e5;
--color-primary-700: #4338ca;
--color-primary-800: #3730a3;
--color-primary-900: #312e81;
--color-primary-950: #1e1b4b;
}

/* Or via the :root pseudo-class */
:root {
--color-primary-50: #eef2ff;
--color-primary-100: #e0e7ff;
--color-primary-200: #c7d2fe;
--color-primary-300: #a5b4fc;
--color-primary-400: #818cf8;
--color-primary-500: #6366f1;
--color-primary-600: #4f46e5;
--color-primary-700: #4338ca;
--color-primary-800: #3730a3;
--color-primary-900: #312e81;
--color-primary-950: #1e1b4b;
}
```