0.2.0 • Published 8 months ago

pakt-ui v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Pakt UI

Pakt UI is a React component library built using Radix UI and Tailwind CSS. It's a collection of repetitive components that are used across the Pakt ecosystem.

Installation

npm install pakt-ui

Components

Button

Renders a button element. You can use the variant prop to change the appearance of the button. The default variant is primary.

Usage

import { Button } from 'pakt-ui';

<Button>Button</Button>

// primary
<Button variant="primary">Button</Button>

Props

PropTypeDefaultDescription
variantstringprimaryThe variant of the button. Can be primary, secondary, danger, outline or transparent.
disabledbooleanfalseWhether the button is disabled.
sizestringmdThe size of the button. Can be xs, sm, md, lg, xl.

Text

Contains sub-components for rendering text elements. The sub-components are <Text.p>, <Text.span>, <Text.label>, <Text.h1>, <Text.h2>, <Text.h3>, and <Text.h4> which render <p>, <span>, <label>, <h1>, <h2>, <h3>, and <h4> elements respectively. You can use the variant prop to change the appearance of the text. The default variant is base.

Usage

import { Text } from 'pakt-ui';

# H1 Element
<Text.h1>Heading 1</Text.h1>

# Paragraph Element
<Text.p>Paragraph</Text.p>

# Span Element
<Text.span>Span</Text.span>

# Label Element
<Text.label>Label</Text.label>

Props

PropTypeDefaultDescription
variantstringbaseThe variant of the text. Can be base, small, large, bold, italic, underline, code
boldbooleanfalseWhether the text is bold.
italicbooleanfalseWhether the text is italic.
underlinebooleanfalseWhether the text is underlined.
strikethroughbooleanfalseWhether the text is strikethrough.

Input

Renders an input element.

Usage

import { Input } from "pakt-ui";

<Input placeholder="Input" />;

Props

PropTypeDefaultDescription
placeholderstringThe placeholder text of the input.
disabledbooleanfalseWhether the input is disabled.
labelstringThe label of the input.
captionstringThe caption of the input.

Textarea

Renders a textarea element.

Usage

import { Textarea } from "pakt-ui";

<Textarea placeholder="Textarea" />;

Props

PropTypeDefaultDescription
placeholderstringThe placeholder text of the textarea.
disabledbooleanfalseWhether the textarea is disabled.
labelstringThe label of the textarea.
captionstringThe caption of the textarea.

Select

Displays a dropdown list of options that the user can select from.

Usage

import { Select } from "pakt-ui";

const OPTIONS = [
  { value: "1", label: "Option 1" },
  { value: "2", label: "Option 2" },
  { value: "3", label: "Option 3" },
];

<Select options={OPTIONS} label="Label" placeholder="Placeholder" onChange={(value) => {}} />;

Props

PropTypeDefaultDescription
options{value: string; label: string}[]The options to display in the dropdown.
placeholderstringThe placeholder text of the select.
disabledbooleanfalseWhether the select is disabled.
labelstringThe label of the select.
onChange(value: string) => voidThe callback function for onChange.

Checkbox

Renders a checkbox element.

Usage

import { Checkbox } from "pakt-ui";

<Checkbox checked={true} onCheckedChange={(checked) => {}} />;

Props

PropTypeDefaultDescription
checkedbooleanfalseWhether the checkbox is checked.
disabledbooleanfalseWhether the checkbox is disabled.
onCheckedChange(checked: boolean) => voidThe callback function for onCheckedChange.

Switch

Switches are used as an alternative to checkboxes when there is only one option to select.

Usage

import { Switch } from "pakt-ui";

<Switch checked={true} onCheckedChange={(checked) => {}} />;

Props

PropTypeDefaultDescription
checkedbooleanfalseWhether the switch is checked.
disabledbooleanfalseWhether the switch is disabled.
onCheckedChange(checked: boolean) => voidThe callback function for onCheckedChange.

Slider

Renders a slider element.

Usage

import { Slider } from "pakt-ui";

<Slider value={50} onChange={(value) => {}} />;

Props

PropTypeDefaultDescription
valuenumberThe value of the slider.
disabledbooleanfalseWhether the slider is disabled.
onChange(value: number) => voidThe callback function for onChange.
onValueCommit(value: number) => voidThe callback function for onValueCommit.

Progress

Renders a progress bar element.

Usage

import { Progress } from "pakt-ui";

<Progress value={50} />;

Props

PropTypeDefaultDescription
valuenumberThe value of the progress
heightnumber4The height of the progress bar