A powerful and customizable data grid component built with Fluent UI and TanStack Table (React Table v8). This component combines the beautiful design system of Fluent UI with the powerful features of TanStack Table to create a feature-rich data grid solution.
- 🎨 Fluent UI Design System - Beautiful, consistent Microsoft design language
- 📊 TanStack Table Integration - Powerful table functionality with minimal setup
- 🔍 Real-time Search - Fast, client-side search across all fields
- 📱 Responsive Design - Works seamlessly across different screen sizes
- 📄 Pagination - Built-in pagination for large datasets
- 👤 User Avatar Integration - Visual user representation with Fluent UI avatars
- 📅 Date Formatting - Clean, consistent date display
- 🎯 Action Buttons - Integrated view, delete, and more actions
- 🌈 Theme Support - Follows Fluent UI theming system
# Clone the repository
git clone https://github.com/yourusername/fluent-tanstack-grid.git
# Navigate to project directory
cd fluent-tanstack-grid
# Install dependencies
npm install
This project requires the following packages:
{
"dependencies": {
"@fluentui/react-components": "^9.x.x",
"@fluentui/react-icons": "^2.x.x",
"@tanstack/react-table": "^8.x.x",
"react": "^18.x.x",
"react-dom": "^18.x.x"
}
}
Basic usage example:
import { Table } from './components';
import { sampleUsers } from './constants';
function App() {
return (
<Table
data={sampleUsers}
columns={columns}
showPagination
/>
);
}
With search functionality:
import { useState, useMemo } from 'react';
import { SearchBox } from '@fluentui/react-components';
function App() {
const [searchQuery, setSearchQuery] = useState('');
const filteredData = useMemo(() => {
return sampleUsers.filter(user => {
const searchTerm = searchQuery.toLowerCase();
const userName = user.User.Title.toLowerCase();
const userEmail = user.User.EMail.toLowerCase();
return userName.includes(searchTerm) || userEmail.includes(searchTerm);
});
}, [searchQuery]);
return (
<>
<SearchBox
placeholder="Search users..."
value={searchQuery}
onChange={(e, data) => setSearchQuery(data.value)}
/>
<Table
data={filteredData}
columns={columns}
showPagination
/>
</>
);
}
The component expects data in the following format:
interface UserData {
User: {
Title: string;
EMail: string;
};
Modified: string;
Id: number;
}
You can customize the columns by modifying the columns definition:
const columns: ColumnDef<UserData>[] = [
{
accessorKey: '',
header: 'User',
cell: ({row}) => {
return (
<UserAvatar
name={row.original?.User?.Title}
email={row.original?.User?.EMail}
/>
);
}
},
// ... more columns
];
The component uses Fluent UI's theming system. You can customize the theme by wrapping your app with FluentProvider
:
import { FluentProvider, webLightTheme } from "@fluentui/react-components";
function App() {
return (
<FluentProvider theme={webLightTheme}>
{/* Your components */}
</FluentProvider>
);
}
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Microsoft Fluent UI Team
- TanStack Table Team
- All contributors to this project
For support, please open an issue in the GitHub repository or contact [your-email@example.com].