@wealthfolio/ui
v2.0.0
Published
Wealthfolio UI components based on shadcn/ui and Tailwind CSS
Maintainers
Readme
@wealthfolio/ui
Wealthfolio's shared UI component library built on top of shadcn/ui and Tailwind CSS.
Overview
The @wealthfolio/ui package provides a complete design system for Wealthfolio
addons, ensuring consistent styling and user experience across all extensions.
Features
- 🎨 Complete shadcn/ui components - All essential UI primitives
- 💰 Wealthfolio-specific components - Financial data display components
- 🎭 Consistent theming - Dark/light mode support with CSS variables
- 📦 Tree-shakeable - Import only what you need
- 🔧 TypeScript ready - Full type safety
Installation
For addons:
npm install @wealthfolio/uiPackage Structure
packages/ui/
├── src/
│ ├── components/
│ │ ├── ui/ # All shadcn/ui components
│ │ ├── icons.tsx # Wealthfolio icons
│ │ ├── amount-display.tsx
│ │ └── ... # Financial components
│ ├── lib/
│ │ └── utils.ts # Utility functions (cn, etc.)
│ └── index.ts # Main exports
├── components.json # Shadcn CLI config
├── tailwind.config.js # Tailwind config
└── package.jsonUsage
Basic Components
import { Button, Card, CardContent } from "@wealthfolio/ui";
function MyComponent() {
return (
<Card>
<CardContent>
<Button>Click me</Button>
</CardContent>
</Card>
);
}Financial Components
import { AmountDisplay, GainAmount, GainPercent } from "@wealthfolio/ui";
function FinancialData() {
return (
<div>
<AmountDisplay amount={1234.56} currency="USD" />
<GainAmount gain={123.45} />
<GainPercent percentage={5.67} />
</div>
);
}Complete Addon Example
// Import components
import { Button, Card, CardContent, AmountDisplay } from "@wealthfolio/ui";
// Import styles (once in your main file)
import "@wealthfolio/ui/styles";
function MyAddon() {
return (
<Card>
<CardContent>
<Button>Click me</Button>
<AmountDisplay amount={1234.56} currency="USD" />
</CardContent>
</Card>
);
}Benefits for Addon Developers
- ✅ Automatic theming - Inherits light/dark mode from main app
- ✅ Consistent styling - Same look and feel as main app
- ✅ Financial components - Ready-to-use components for financial data
- ✅ Tree-shakeable - Only bundles what you use
- ✅ TypeScript support - Full type safety
Styling
Import the CSS file in your addon:
import "@wealthfolio/ui/styles";Or in your CSS:
@import "@wealthfolio/ui/styles";Components
Core UI (shadcn/ui)
All standard shadcn/ui components with Wealthfolio's Flexoki theme applied:
Button- Various button styles and sizesCard- Container component with header/content/footerInput- Form input with validation stylesLabel- Accessible form labelsBadge- Status indicatorsDialog- Modal dialogsDropdown- Dropdown menusTable- Data tablesTabs- Tab navigation- And many more...
Financial Components
AmountDisplay- Formatted currency displayGainAmount- Gain/loss amount with color codingGainPercent- Percentage change displayIcons- Financial and general purpose icons
Utility Functions
cn()- Class name utility with tailwind-merge- Theme utilities and helpers
Theming
The components use CSS variables for theming. The main app provides the theme context, so addons automatically inherit the current theme (light/dark mode).
The Flexoki theme is defined in packages/ui/src/styles.css. Updates here
automatically apply to:
- Main application
- All addons using
@wealthfolio/ui
Development
Basic Commands
# Build the package
pnpm build
# Watch for changes
pnpm dev
# Type check
pnpm lintFor Main App Development
Adding new components to UI package:
cd packages/ui
npx shadcn-ui@latest add buttonAdding components to main app (legacy):
npx shadcn-ui@latest add buttonUpdating Components
When updating shared components:
- Edit in
packages/ui/src/components/ - Build the package:
cd packages/ui && npm run build - Components automatically available to addons
Development Workflow
Adding New Component
cd packages/uinpx shadcn-ui@latest add [component]- Customize if needed for Wealthfolio
- Export in
src/index.ts - Build and test with addons
Updating Existing Component
- Edit in
packages/ui/src/components/ npm run build- Test with addons
- Update version if breaking changes
Best Practices
For Addon Developers
- Always import from
@wealthfolio/uiinstead of creating custom components - Import styles once in your main addon file
- Use provided utility functions for consistent styling
- Leverage financial components for data display
For Core Development
- Add new components to UI package, not main app
- Use semantic versioning for UI package updates
- Test changes against example addons
- Document new components in README
Updating Components
cd packages/ui
npx shadcn-ui@latest add [component]
npx shadcn@latest add accordion alert-dialog alert avatar badge button calendar checkbox collapsible command dialog dropdown-menu form hover-card input label popover progress radio-group scroll-area select separator sheet skeleton switch table tabs textarea toggle-group toggle tooltip
npm run buildThis strategy ensures consistent UI/UX across the entire Wealthfolio ecosystem while maintaining developer efficiency and user experience.
