@unimatrix-01/ui
v1.0.11
Published
A modern React UI component library with a cyberpunk theme, built with TypeScript, Tailwind CSS, and Vite.
Maintainers
Readme
@unimatrix-01/ui
A modern React UI component library with a cyberpunk theme, built with TypeScript, Tailwind CSS, and Vite.
Installation
npm install @unimatrix-01/ui
# or
yarn add @unimatrix-01/ui
# or
pnpm add @unimatrix-01/uiCreating a New Project
You can create a new project with Borg UI using our CLI tool. The tool will create a new directory with your specified name and set up the project inside it:
# Using npm
npx @unimatrix-01/create-borg-ui my-app
# Using yarn
yarn create @unimatrix-01/borg-ui my-app
# Using pnpm
pnpm create @unimatrix-01/borg-ui my-appThe CLI will:
- Create a new directory called
my-appin your current location - Create a new Vite + React + TypeScript project in that directory
- Install all necessary dependencies including Borg UI
- Set up Tailwind CSS with the correct configuration
- Create example components using Borg UI
- Set up a basic project structure following best practices
After creation, you can start developing:
cd my-app
npm run devUsage
First, import the CSS in your app's entry point (e.g., main.tsx or App.tsx):
import '@unimatrix-01/ui/dist/index.css';Then import and use the components:
import { Button, Card, TextInput } from '@unimatrix-01/ui';
function App() {
return (
<div>
<Button>Click me</Button>
<Card title="My Card">Card content</Card>
<TextInput label="Username" placeholder="Enter username" />
</div>
);
}Component Documentation
Avatar
A circular or square avatar component that can display an image, initials, or both.
<Avatar
src="https://example.com/avatar.jpg"
alt="User Avatar"
initials="JD"
status="online"
size="md"
rounded={true}
/>Props:
src: URL of the avatar imagealt: Alt text for the imageinitials: Fallback initials to display if image fails to loadstatus: 'online' | 'offline' | 'away' | 'busy'size: 'sm' | 'md' | 'lg'rounded: boolean (default: true)
Badge
A small badge component for displaying status, counts, or labels.
<Badge
variant="info"
pill={true}
removable={true}
onRemove={() => console.log('removed')}
>
New
</Badge>Props:
variant: 'default' | 'info' | 'success' | 'warning' | 'error'pill: boolean (default: false)removable: boolean (default: false)onRemove: () => void
Button
A versatile button component with multiple styles and variants.
<Button
styleType="primary"
icon="left"
iconName="placeholder"
label="Click Me"
>
Button Text
</Button>Props:
styleType: 'primary' | 'secondary' | 'destructive' | 'info' | 'warn'icon: 'left' | 'right' | 'off'iconName: string (icon identifier)label: stringdisabled: booleanonClick: () => void
ToggleButton
A button that can be toggled on/off.
<ToggleButton
styleType="primary"
icon="left"
iconName="placeholder"
label="Toggle Me"
defaultToggled={false}
onToggledChange={(toggled) => console.log(toggled)}
/>Props:
styleType: 'primary' | 'secondary' | 'destructive' | 'info' | 'warn'icon: 'left' | 'right' | 'off'iconName: stringlabel: stringdefaultToggled: booleantoggled: boolean (controlled mode)onToggledChange: (toggled: boolean) => void
Card
A container component for grouping related content.
<Card
title="Card Title"
subtitle="Card Subtitle"
variant="primary"
image={imageUrl}
actions={<Button>Action</Button>}
clickable={true}
onClick={() => console.log('clicked')}
>
Card content
</Card>Props:
title: stringsubtitle: stringvariant: 'default' | 'primary' | 'outlined'image: string (URL)actions: ReactNodeclickable: booleanonClick: () => voiddisabled: boolean
Checkbox
A checkbox input component.
<Checkbox
checked={checked}
onChange={setChecked}
label="Check me"
indeterminate={false}
disabled={false}
/>Props:
checked: booleanonChange: (checked: boolean) => voidlabel: stringindeterminate: booleandisabled: boolean
DatePicker
A date selection component.
<DatePicker
label="Select Date"
value={date}
onChange={setDate}
pickerType="single" // or "range" or "multiple"
placeholder="Pick a date"
clearable={true}
helperText="Select a date"
error={false}
/>Props:
label: stringvalue: Date | [Date, Date] | Date[] | nullonChange: (value: Date | [Date, Date] | Date[] | null) => voidpickerType: 'single' | 'range' | 'multiple'placeholder: stringclearable: booleanhelperText: stringerror: boolean
Dropdown
A dropdown selection component.
<Dropdown
label="Select Option"
options={options}
value={selected}
onChange={setSelected}
isOpen={isOpen}
onOpenChange={setIsOpen}
placeholder="Select..."
multiSelect={false}
/>Props:
label: stringoptions: DropdownOption[]value: string | string[]onChange: (value: string | string[]) => voidisOpen: booleanonOpenChange: (isOpen: boolean) => voidplaceholder: stringmultiSelect: boolean
Icon
A component for displaying SVG icons.
<Icon
name="placeholder"
size={32}
color="var(--content-primary)"
/>Props:
name: stringsize: numbercolor: string
Menu
A navigation menu component.
<Menu
items={menuItems}
orientation="horizontal" // or "vertical"
/>Props:
items: MenuItem[]orientation: 'horizontal' | 'vertical'
Modal
A modal dialog component.
<Modal
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Modal Title"
status="info" // or "success", "warning", "error"
icon="placeholder"
actions={[
{
label: "Cancel",
onClick: () => setIsOpen(false),
style: "secondary"
},
{
label: "Confirm",
onClick: () => setIsOpen(false),
style: "primary",
autoFocus: true
}
]}
>
Modal content
</Modal>Props:
isOpen: booleanonClose: () => voidtitle: stringstatus: 'info' | 'success' | 'warning' | 'error'icon: stringactions: ModalAction[]
Radio
A radio button component.
<Radio
name="group"
value="option1"
checked={selected === "option1"}
onChange={setSelected}
label="Option 1"
disabled={false}
/>Props:
name: stringvalue: stringchecked: booleanonChange: (value: string) => voidlabel: stringdisabled: boolean
Table
A data table component with sorting and filtering.
<Table
columns={[
{ key: "name", label: "Name", sortable: true },
{ key: "age", label: "Age", sortable: true }
]}
data={tableData}
pageSize={10}
filterText={filter}
onFilterTextChange={setFilter}
showPagination={true}
selectable={true}
selectedRows={selectedRows}
onSelectedRowsChange={setSelectedRows}
/>Props:
columns: TableColumn[]data: any[]pageSize: numberfilterText: stringonFilterTextChange: (text: string) => voidshowPagination: booleanselectable: booleanselectedRows: number[]onSelectedRowsChange: (rows: number[]) => void
TextInput
A text input component with various states and features.
<TextInput
label="Username"
value={value}
onChange={setValue}
placeholder="Enter username"
error={false}
warning={false}
disabled={false}
maxLength={50}
dropdownOptions={["Option 1", "Option 2"]}
validationRules={{
required: true,
minLength: 3
}}
errorMessage="Invalid input"
/>Props:
label: stringvalue: stringonChange: (value: string) => voidplaceholder: stringerror: booleanwarning: booleandisabled: booleanmaxLength: numberdropdownOptions: string[]validationRules: ValidationRuleserrorMessage: string
TextArea
A multi-line text input component.
<TextArea
label="Description"
value={value}
onChange={setValue}
placeholder="Enter description"
lineHeight={4}
maxLength={500}
error={false}
warning={false}
disabled={false}
errorMessage="Invalid input"
warningMessage="Warning message"
/>Props:
label: stringvalue: stringonChange: (value: string) => voidplaceholder: stringlineHeight: numbermaxLength: numbererror: booleanwarning: booleandisabled: booleanerrorMessage: stringwarningMessage: string
TimePicker
A time selection component.
<TimePicker
label="Select Time"
value={time}
onChange={setTime}
format="hh:mm A"
showSeconds={false}
step={15}
minTime={new Date(0, 0, 0, 9, 0)}
maxTime={new Date(0, 0, 0, 17, 0)}
clearable={true}
helperText="Select a time"
error={false}
/>Props:
label: stringvalue: Date | nullonChange: (value: Date | null) => voidformat: stringshowSeconds: booleanstep: numberminTime: DatemaxTime: Dateclearable: booleanhelperText: stringerror: boolean
Toggle
A simple toggle switch component.
<Toggle
checked={checked}
onToggle={setChecked}
disabled={false}
/>Props:
checked: booleanonToggle: (checked: boolean) => voiddisabled: boolean
Tooltip
A tooltip component for displaying additional information.
<Tooltip
content="Tooltip content"
placement="top" // or "right", "bottom", "left"
disabled={false}
>
<button>Hover me</button>
</Tooltip>Props:
content: ReactNodeplacement: 'top' | 'right' | 'bottom' | 'left'disabled: boolean
WarpSpeedBackground
A dynamic background component with a warp speed effect.
<WarpSpeedBackground />No props required.
Tailwind CSS Setup
This library uses Tailwind CSS. Make sure your project has Tailwind CSS installed and configured. Add the following to your tailwind.config.js:
module.exports = {
content: [
// ... your content configuration
'./node_modules/@unimatrix-01/ui/dist/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
// ... your theme extensions
},
},
plugins: [
// ... your plugins
],
};Development
# Install dependencies
npm install
# Start development server
npm run dev
# Build the library
npm run buildLicense
MIT
