0.6.0 • Published 11 months ago

@carclarity/ui v0.6.0

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
11 months ago

CarClarity UI

CarClarity UI is a React-based design system that simplifies the development of consistent, themed UI components. Currently, the library includes a customizable Button component with top-level theming support.


Installation

Install the package using your preferred package manager:

Using npm:

npm install carclarity-ui

Using yarn:

yarn add carclarity-ui

Setup

Wrap your application with the ThemeProvider to provide theme context to the components:

import React from "react";
import ReactDOM from "react-dom/client";
import { ThemeProvider } from "carclarity-ui";

const theme = {
  buttons: {
    primary: "bg-blue-500 text-white rounded hover:bg-blue-600",
    secondary: "bg-gray-300 text-black rounded hover:bg-gray-400",
  },
};

ReactDOM.createRoot(document.getElementById("root")!).render(
  <ThemeProvider theme={theme}>
    <App />
  </ThemeProvider>
);

Components

Button

The Button component provides a customizable button element with support for variants, sizes, and additional props.

Usage

import React from "react";
import { Button } from "@carclarity/ui";

const App = () => {
  return (
    <div>
      <Button variant="primary" size="medium">
        Primary Button
      </Button>
      <Button variant="secondary" size="large" onClick={() => alert("Clicked!")}>
        Secondary Button
      </Button>
    </div>
  );
};

export default App;

Props

NameTypeDefaultDescription
variant'primary' \| 'secondary''primary'Sets the button style variant.
size'small' \| 'medium' \| 'large''medium'Adjusts the button's size.
classNamestring''Adds additional CSS classes.
...propsReact.ButtonHTMLAttributesundefinedAllows passing native HTML button attributes.

Theming

You can define your custom theme using the ThemeProvider. Below is an example structure for the theme:

const theme = {
  buttons: {
    primary: "bg-blue-500 text-white rounded hover:bg-blue-600",
    secondary: "bg-gray-300 text-black rounded hover:bg-gray-400",
  },
};
0.6.0

11 months ago

0.5.8

11 months ago

0.5.7

11 months ago

0.5.6

11 months ago

0.5.5

12 months ago

0.5.4

12 months ago

0.5.3

12 months ago

0.5.2

12 months ago

0.5.1

12 months ago

0.5.0

12 months ago

0.4.9

12 months ago

0.4.8

12 months ago

0.4.7

12 months ago

0.4.6

12 months ago

0.4.5

12 months ago

0.4.4

12 months ago

0.4.3

12 months ago

0.4.2

12 months ago

0.4.1

12 months ago

0.4.0

12 months ago

0.3.9

12 months ago

0.3.8

12 months ago

0.3.7

12 months ago

0.3.6

12 months ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago