0.0.58 • Published 7 months ago

avihang-react-design v0.0.58

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

avihang-react-design

Overview

A modern, accessible React UI component library designed for Avihang Company.

Installation

npm install avihang-react-design
# or
yarn add avihang-react-design

Importing Library Styles

To use the styles, import them in your main entry file (src/main.tsx):

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "avihang-react-design/dist/style.css";

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <App />
  </StrictMode>
);

Quick Start

import { Button, Tooltip } from "avihang-react-design";

function App() {
  return (
    <div>
      <Button variant="subtle" size="lg" styles="natural">
        Click me
      </Button>
      <Tooltip content="home">
        <Button styles="natural">Go home</Button>
      </Tooltip>
    </div>
  );
}

Core Principles

  • Customization: Easily themeable through CSS variables.
  • Performance: Lightweight and tree-shakeable.
  • TypeScript: Full TypeScript support with detailed type definitions.

Components

Button

The Button component is used to trigger actions or events.

Props

PropTypeDefaultDescription
styles'primary' \| 'secondary' \| 'natural''primary'The visual style of the button.
size'sm' \| 'md' \| 'lg''md'The size of the button.
disabledbooleanfalseWhether the button is disabled.
onClickReact.MouseEventHandler-Click event handler.

Examples

// Primary button
<Button styles="primary">Primary Button</Button>

// Secondary button
<Button styles="secondary" size="lg">
  Large Secondary Button
</Button>

// Disabled button
<Button disabled>Disabled Button</Button>

Dependencies

This project uses Radix UI and ShadCN for headless UI components.

Custom Theme

You can create a custom theme by modifying your index.css file in the libary:

 [data-theme="halloween"] {
    --color-Primary-50: 255 242 204; /* Light Cream */
    --color-Primary-100: 255 230 153; /* Light Yellow */
    --color-Primary-200: 255 217 102; /* Yellow */
    --color-Primary-300: 255 204 51; /* Golden Yellow */
    --color-Primary-400: 255 191 0; /* Gold */
    --color-Primary-500: 255 178 0; /* DeeP Gold */
    --color-Primary-600: 230 162 0; /* Darker Gold */
    --color-Primary-700: 204 147 0; /* Even Darker Gold */
    --color-Primary-800: 178 132 0; /* Almost Brown Gold */
    --color-Primary-900: 153 117 0; /* Brown Gold */
    --color-Primary: 255 178 0; /* Deep Gold */

    --color-Secondary-50: 255 102 0; /* Light Orange */
    --color-Secondary-100: 255 128 25; /* Lighter Orange */
    --color-Secondary-200: 255 153 51; /* Light-Medium Orange */
    --color-Secondary-300: 255 178 77; /* Medium Orange */

and then use useTheme custom hook in your project to change the theme

import { Button, useTheme } from "avihang-react-design";

const App = () => {
  const  setTheme  = useTheme(); 

  return (
    <div>
      <Button styles="primary" onClick={() => setTheme("halloween")}>
        Switch to Halloween Theme
      </Button>
    </div>
  );
};

Building & Publishing

To add or modify components, follow these steps:

  1. Update the version number in package.json.
  2. Run the build process:
    npm run build
  3. Publish the package to npm:
    npm publish
0.0.44

7 months ago

0.0.45

7 months ago

0.0.47

7 months ago

0.0.51

7 months ago

0.0.52

7 months ago

0.0.53

7 months ago

0.0.54

7 months ago

0.0.55

7 months ago

0.0.56

7 months ago

0.0.58

7 months ago

0.0.50

7 months ago

0.0.48

7 months ago

0.0.49

7 months ago

0.0.40

7 months ago

0.0.41

7 months ago

0.0.42

7 months ago

0.0.43

7 months ago

0.0.38

7 months ago

0.0.39

7 months ago

0.0.20

7 months ago

0.0.21

7 months ago

0.0.22

7 months ago

0.0.23

7 months ago

0.0.24

7 months ago

0.0.25

7 months ago

0.0.37

7 months ago

0.0.15

7 months ago

0.0.16

7 months ago

0.0.17

7 months ago

0.0.18

7 months ago

0.0.19

7 months ago

0.0.30

7 months ago

0.0.31

7 months ago

0.0.32

7 months ago

0.0.33

7 months ago

0.0.34

7 months ago

0.0.35

7 months ago

0.0.36

7 months ago

0.0.14

7 months ago

0.0.26

7 months ago

0.0.28

7 months ago

0.0.29

7 months ago

0.0.12

10 months ago

0.0.13

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago