
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
ZentrixUI - A modern, highly customizable and accessible React file upload component library with multiple variants, JSON-based configuration, and excellent developer experience.
A modern, highly customizable and accessible React file upload component library with multiple variants, JSON-based configuration, and excellent developer experience. Built with TypeScript, TailwindCSS, and Radix UI primitives.
npm install zentrixui
# or
pnpm add zentrixui
# or
yarn add zentrixui
import { FileUpload } from 'zentrixui'
import 'zentrixui/styles'
function App() {
const handleUpload = async (files: File[]) => {
// Handle file upload
console.log('Uploading files:', files)
}
return (
<FileUpload
variant="dropzone"
onUpload={handleUpload}
accept="image/*"
maxSize={5 * 1024 * 1024} // 5MB
multiple
/>
)
}
Traditional file input styled as a button.
<FileUpload
variant="button"
onUpload={handleUpload}
size="lg"
radius="md"
/>
Drag-and-drop area with visual feedback.
<FileUpload
variant="dropzone"
onUpload={handleUpload}
accept="image/*,video/*"
multiple
maxFiles={10}
/>
Shows file previews after selection with upload progress.
<FileUpload
variant="preview"
onUpload={handleUpload}
multiple
maxSize={10 * 1024 * 1024}
/>
Specialized for image files with thumbnail preview.
<FileUpload
variant="image-only"
onUpload={handleUpload}
accept="image/*"
maxSize={2 * 1024 * 1024}
/>
Handles multiple files with individual progress tracking.
<FileUpload
variant="multi-file"
onUpload={handleUpload}
multiple
maxFiles={20}
accept=".pdf,.doc,.docx"
/>
interface FileUploadProps {
// Core behavior
variant?: 'button' | 'dropzone' | 'preview' | 'image-only' | 'multi-file'
size?: 'sm' | 'md' | 'lg'
radius?: 'none' | 'sm' | 'md' | 'lg' | 'full'
disabled?: boolean
multiple?: boolean
accept?: string
maxSize?: number
maxFiles?: number
// Styling
theme?: 'light' | 'dark' | 'auto'
className?: string
style?: React.CSSProperties
// Customization
icon?: ReactNode
iconPlacement?: 'left' | 'right' | 'top' | 'bottom'
placeholder?: string
borderStyle?: 'solid' | 'dashed' | 'dotted' | 'none'
borderWidth?: 'thin' | 'medium' | 'thick'
// Event handlers
onUpload?: (files: File[]) => Promise<void>
onError?: (error: string) => void
onProgress?: (progress: number, file?: UploadFile) => void
onFileSelect?: (files: File[]) => void
onFileRemove?: (fileId: string) => void
// Configuration
config?: FileUploadConfig | string // Config object or path to JSON file
// Accessibility
ariaLabel?: string
ariaDescribedBy?: string
children?: ReactNode
}
Create a file-upload.config.json file for declarative configuration:
{
"defaults": {
"variant": "dropzone",
"size": "md",
"radius": "md",
"theme": "auto",
"multiple": true,
"maxSize": 10485760,
"maxFiles": 5
},
"validation": {
"allowedTypes": ["image/*", "application/pdf"],
"allowedExtensions": [".jpg", ".png", ".pdf"],
"maxSize": 10485760,
"maxFiles": 5
},
"styling": {
"theme": "auto",
"colors": {
"primary": "#3b82f6",
"success": "#10b981",
"error": "#ef4444"
}
},
"labels": {
"uploadText": "Choose files to upload",
"dragText": "Drag and drop files here",
"successText": "Upload successful"
},
"features": {
"dragAndDrop": true,
"preview": true,
"progress": true,
"removeFiles": true
}
}
Then use it in your component:
import config from './file-upload.config.json'
<FileUpload config={config} onUpload={handleUpload} />
Wrap your app with the ThemeProvider for consistent theming:
import { ThemeProvider } from 'zentrixui'
function App() {
return (
<ThemeProvider theme="auto">
<YourApp />
</ThemeProvider>
)
}
const customTheme = {
colors: {
primary: '#8b5cf6',
secondary: '#64748b',
success: '#059669',
error: '#dc2626',
background: '#ffffff',
foreground: '#1f2937'
},
spacing: {
padding: '1.5rem',
margin: '0.75rem',
gap: '0.75rem'
}
}
<FileUpload
config={{ styling: customTheme }}
onUpload={handleUpload}
/>
The component is built with accessibility in mind:
<FileUpload
ariaLabel="Upload your documents"
ariaDescribedBy="upload-help-text"
onUpload={handleUpload}
/>
<div id="upload-help-text">
Supported formats: PDF, DOC, DOCX. Maximum size: 10MB.
</div>
const handleUpload = async (files: File[]) => {
// Custom validation
const validFiles = files.filter(file => {
if (file.size > 5 * 1024 * 1024) {
console.error(`File ${file.name} is too large`)
return false
}
return true
})
// Upload valid files
for (const file of validFiles) {
await uploadFile(file)
}
}
<FileUpload
onUpload={handleUpload}
onError={(error) => console.error('Upload error:', error)}
maxSize={5 * 1024 * 1024}
accept="image/*,.pdf"
/>
const [uploadProgress, setUploadProgress] = useState<Record<string, number>>({})
const handleProgress = (progress: number, file?: UploadFile) => {
if (file) {
setUploadProgress(prev => ({
...prev,
[file.id]: progress
}))
}
}
<FileUpload
variant="multi-file"
onUpload={handleUpload}
onProgress={handleProgress}
multiple
/>
import { mockUploadService } from 'zentrixui'
// Configure mock service for development
mockUploadService.configure({
delay: 2000,
successRate: 0.8,
chunkSize: 1024 * 1024
})
const handleUpload = async (files: File[]) => {
for (const file of files) {
try {
const result = await mockUploadService.upload(file, {
onProgress: (progress) => console.log(`${file.name}: ${progress}%`)
})
console.log('Upload successful:', result)
} catch (error) {
console.error('Upload failed:', error)
}
}
}
The library is built with TypeScript and provides comprehensive type definitions:
import type {
FileUploadProps,
FileUploadConfig,
UploadFile,
FileUploadState,
FileValidationResult
} from 'zentrixui'
const config: FileUploadConfig = {
defaults: {
variant: 'dropzone',
size: 'lg',
multiple: true
},
// ... rest of config with full type safety
}
const handleFileSelect = (files: File[]) => {
// Type-safe file handling
}
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE file for details.
See CHANGELOG.md for version history and updates.
FAQs
ZentrixUI - A modern, highly customizable and accessible React file upload component library with multiple variants, JSON-based configuration, and excellent developer experience.
The npm package zentrixui receives a total of 0 weekly downloads. As such, zentrixui popularity was classified as not popular.
We found that zentrixui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.