A modern, feature-rich React DataTable component with search, selection, and customizable columns
npm install @xinosolutions/react-datatable---
XinoSolutions is a software development company dedicated to creating high-quality, developer-friendly solutions. We specialize in building modern React components and tools that help developers build better applications faster. Our commitment to excellence, clean code, and user experience drives everything we create.
This package is part of our open-source initiative to contribute valuable tools to the React ecosystem.
---
- ✅ Real-time Search - Search across all columns with instant filtering
- ✅ Pagination - Full-featured pagination with customizable page sizes
- ✅ Row Selection - Checkbox and radio button selection support
- ✅ Customizable Columns - Multiple column types (text, number, HTML, custom render)
- ✅ Theme Customization - Customizable theme colors via CSS variables
- ✅ Responsive Design - Mobile-friendly and responsive layout
- ✅ Sticky Header - Header stays visible while scrolling
- ✅ Empty States - Beautiful empty state messages
- ✅ Accessibility - ARIA labels and keyboard navigation support
- ✅ TypeScript Ready - Works seamlessly with TypeScript projects
- ✅ Zero Dependencies - No external dependencies (except React)
---
``bash`
npm install @xinosolutions/react-datatable
or
`bash`
yarn add @xinosolutions/react-datatable
or
`bash`
pnpm add @xinosolutions/react-datatable
---
`jsx
import React, { useState } from 'react';
import { DataTable } from '@xinosolutions/react-datatable';
function App() {
const [selected, setSelected] = useState([]);
const rows = [
{ id: 1, name: 'John Doe', email: 'john@example.com', role: 'Developer' },
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'Designer' },
{ id: 3, name: 'Bob Johnson', email: 'bob@example.com', role: 'Manager' },
];
const columns = [
{ key: 'id', label: 'ID' },
{ key: 'name', label: 'Name' },
{ key: 'email', label: 'Email' },
{ key: 'role', label: 'Role' },
];
return (
columns={columns}
checkboxSelection={{
selected,
setSelected,
selectBy: 'id'
}}
/>
);
}
export default App;
`
---
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| rows | Array
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| showTopPagination | boolean | true | Show pagination controls at the top |showBottomPagination
| | boolean | true | Show pagination controls at the bottom |defaultPageSize
| | number | 50 | Default number of items per page |pageSizeOptions
| | Array | [10, 50, 100, 500] | Available page size options |
| Property | Type | Required | Description |
|----------|------|----------|-------------|
| selected | Array
| Property | Type | Description |
|----------|------|-------------|
| --table-theme-color | string | CSS variable for theme color (default: #4FAFA0) |
---
Displays the value from the row object using the specified key.
`jsx`
{ key: 'name', label: 'Name' }
Displays the row number automatically.
`jsx`
{ label: '#', type: 'number' }
Renders HTML content from the row data.
`jsx`
{
key: 'description',
label: 'Description',
type: 'html'
}
Use a custom render function for complete control over cell content.
`jsx`
{
label: 'Actions',
render: (row, index) => (
)
}
---
`jsx
import { DataTable } from '@xinosolutions/react-datatable';
const rows = [
{ id: 1, name: 'John Doe', email: 'john@example.com' },
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' },
];
const columns = [
{ key: 'id', label: 'ID' },
{ key: 'name', label: 'Name' },
{ key: 'email', label: 'Email' },
];
`
`jsx
import { useState } from 'react';
import { DataTable } from '@xinosolutions/react-datatable';
function App() {
const [selected, setSelected] = useState([]);
return (
columns={columns}
checkboxSelection={{
selected,
setSelected,
selectBy: 'id'
}}
/>
);
}
`
`jsx`
columns={columns}
pagination={{
showTopPagination: true,
showBottomPagination: false,
defaultPageSize: 25,
pageSizeOptions: [10, 25, 50, 100, 200]
}}
/>
`jsx`
columns={columns}
theme={{
'--table-theme-color': '#3b82f6' // Custom blue theme
}}
/>
`jsx`
const columns = [
{ label: '#', type: 'number' },
{ key: 'id', label: 'ID' },
{ key: 'name', label: 'Name' },
{ key: 'email', label: 'Email' },
{
key: 'description',
label: 'Description',
type: 'html'
},
{
label: 'Actions',
render: (row) => (
)
},
];
---
The DataTable includes built-in search functionality that:
- Searches across all columns automatically
- Filters results in real-time as you type
- Shows result count (e.g., "5 of 12 results")
- Displays "No Data Found" when search returns no results
- Resets pagination to page 1 when search query changes
The search is case-insensitive and searches all column values that have a key property.
---
- First/Previous/Next/Last buttons - Navigate between pages
- Page numbers - Click to jump to a specific page
- Page size selector - Change items per page
- Record information - Shows "Showing X to Y of Z records"
- Page information - Displays "Page X of Y"
- Smart page number display - Shows ellipsis for large page counts
- Responsive design - Adapts to mobile screens
---
Customize the table theme by passing a theme object with CSS variables:
`jsx`
columns={columns}
theme={{
'--table-theme-color': '#3b82f6' // Your brand color
}}
/>
The theme color is used for:
- Checkbox checked states
- Radio button selected states
- Pagination active page button
- Focus states on interactive elements
Default theme color: #4FAFA0` (teal)
---
- React: 16.8+ / 17+ / 18+ / 19+
- React DOM: 16.8+ / 17+ / 18+ / 19+
---
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
---
MIT License - see LICENSE file for details.
---
For issues, feature requests, or questions:
- 📧 Open an issue on GitHub
- 📦 NPM Package
- 🐙 GitHub Repository
---