@postxl/ui-components
v1.5.3
Published
PostXL UI component library - Radix UI primitives with Tailwind CSS styling
Readme
@postxl/ui-components
A React UI component library built on Radix UI primitives with Tailwind CSS v4 styling.
Installation
npm install @postxl/ui-components
# or
pnpm add @postxl/ui-components
# or
yarn add @postxl/ui-componentsRequirements
- React 18+
- Tailwind CSS 4+
Setup
1. Import the theme CSS
In your main CSS file (e.g., globals.css or index.css), import the theme:
@import 'tailwindcss';
@import '@postxl/ui-components/theme.css';Or if you're using a bundler that supports CSS imports in JS:
import '@postxl/ui-components/theme.css'2. Configure dark mode (optional)
The components support dark mode via the .dark class on the HTML element. You can use the included ThemeProvider:
import { ThemeProvider } from '@postxl/ui-components'
function App() {
return (
<ThemeProvider defaultTheme="system">
{/* Your app */}
</ThemeProvider>
)
}Usage
import { Button, Card, Input } from '@postxl/ui-components'
function MyComponent() {
return (
<Card>
<Input placeholder="Enter your name" />
<Button variant="primary">Submit</Button>
</Card>
)
}Available Components
Basic Components
Accordion- Collapsible content sectionsAlert- Notification messagesAlertDialog- Modal confirmation dialogsAvatar- User profile imagesBadge- Status indicatorsBreadcrumb- Navigation breadcrumbsButton- Interactive buttons with variantsCard/CardHover- Content containersCheckbox/ShadcnCheckbox- Checkable inputsLabel- Form labelsSeparator- Visual dividersSkeleton- Loading placeholdersSpinner/Loader- Loading indicatorsSwitch- Toggle switchesToggle- Toggle buttonsToggleGroup- Grouped toggle buttons
Input Components
Input- Text inputsTextarea- Multi-line text inputsCombobox- Searchable selectSelect- Dropdown selectsSlider- Range slidersRadioGroup- Radio button groupsDatePicker- Date selection
Layout Components
ContentFrame- Content wrapper with headerResizable- Resizable panelsScrollArea- Scrollable containersCollapse- Collapsible sections
Navigation Components
NavigationMenu- Site navigationMenubar- Menu barsPagination- Page navigationCommandPalette/Command- Command palette (⌘K)
Overlay Components
Dialog- Modal dialogsDrawer- Slide-out panelsModal- Modal containersPopover- Floating contentSheet- Side sheetsTooltip- Hover tooltipsDropdownMenu- Dropdown menusContextMenu- Right-click menus
Data Display
Calendar- Calendar displayCarousel- Image carouselsProgress- Progress indicatorsMarkValueRenderer- Value highlighting
Toast Notifications
Toaster/toast- Toast notifications (via Sonner)
Utilities
cn() - Class name merger
Combines Tailwind classes intelligently:
import { cn } from '@postxl/ui-components'
const className = cn('p-4', isActive && 'bg-primary', className)useTheme() - Theme hook
Access and modify the current theme:
import { useTheme } from '@postxl/ui-components'
function ThemeToggle() {
const { theme, setTheme } = useTheme()
return <button onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>Toggle</button>
}Customizing Theme Colors
Override CSS variables in your stylesheet:
:root {
--primary: #your-color;
--primary-foreground: #your-color;
/* ... other variables */
}
.dark {
--primary: #your-dark-color;
/* ... dark theme overrides */
}See @postxl/ui-components/theme.css for all available CSS variables.
License
See LICENSE in the repository root.
