Codexportfolio intelligence
Packages/TypeScript

@philiprehberger/react-ui-primitives

Lightweight React UI primitives - Button, Alert, and more

TypeScriptnpm

Capabilities

README

@philiprehberger/react-ui-primitives

CI npm version Last updated

Lightweight React UI primitives with Tailwind CSS styling

Installation

npm install @philiprehberger/react-ui-primitives clsx

Usage

Button

Multi-variant button with loading state

import { Button } from '@philiprehberger/react-ui-primitives';

<Button variant="primary" onClick={handleClick}>Save</Button>
<Button variant="danger" loading>Deleting...</Button>

Variants: primary, success, danger, secondary

Alert

Alert banner with type-based styling and optional action button.

import { Alert } from '@philiprehberger/react-ui-primitives';

<Alert type="success" message="Changes saved successfully" />
<Alert type="error" message="Something went wrong" onAction={retry} actionText="Retry" />

Types: error, success, warning, info

Spinner

Inline loading spinner with three sizes and an aria-live="polite" label.

import { Spinner } from '@philiprehberger/react-ui-primitives';

<Spinner size="sm" label="Saving" />
<Spinner size="md" />
<Spinner size="lg" />

Badge

Color-variant pill badge sharing the Button palette.

import { Badge } from '@philiprehberger/react-ui-primitives';

<Badge variant="success">Active</Badge>
<Badge variant="warning">Pending</Badge>
<Badge variant="danger">Error</Badge>

API

ExportTypeDescription
ButtonComponentMulti-variant button with loading state and hover text
AlertComponentAlert banner with type-based styling and optional action button
SpinnerComponentLoading spinner (sizes: sm, md, lg) with sr-only label
BadgeComponentPill badge with color variants
ButtonPropsTypeProps: variant?, loading?, hoverText?, plus native button attrs
ButtonVariantType'primary' | 'success' | 'danger' | 'secondary'
AlertPropsTypeProps: type, message, onAction?, actionText?, className?
AlertTypeType'error' | 'success' | 'warning' | 'info'
SpinnerPropsTypeProps: size?, label?, plus native div attrs
SpinnerSizeType'sm' | 'md' | 'lg'
BadgePropsTypeProps: variant?, plus native span attrs
BadgeVariantType'primary' | 'success' | 'danger' | 'warning' | 'secondary'

Development

npm install
npm run build
npm test

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT