
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@manikantsharma/custom-table
Advanced tools
A customizable table component built with MUI Joy and TypeScript
A highly customizable, feature-rich table component built with MUI Joy and TypeScript. Perfect for creating data tables with sorting, pagination, selection, and custom rendering capabilities.
npm install @yourname/custom-table
# Peer dependencies (if not already installed)
npm install react react-dom @mui/joy @mui/icons-material @mui/utils
import React from "react";
import { CustomTable, TableColumn } from "@yourname/custom-table";
interface User {
id: number;
name: string;
email: string;
status: "active" | "inactive";
}
const data: User[] = [
{ id: 1, name: "John Doe", email: "john@example.com", status: "active" },
{ id: 2, name: "Jane Smith", email: "jane@example.com", status: "inactive" },
];
const columns: TableColumn<User>[] = [
{ id: "name", label: "Name", sortable: true },
{ id: "email", label: "Email", sortable: true },
{ id: "status", label: "Status", sortable: true },
];
function MyTable() {
return (
<CustomTable
data={data}
columns={columns}
selectable={true}
pagination={true}
toolbarTitle="Users"
/>
);
}
| Prop | Type | Default | Description |
| ------------------- | ----------------------------------- | ------------------------------- | -------------------------------- | -------------------------- | ------------ | ------------- |
| data
| T[]
| Required | Array of data objects to display |
| columns
| TableColumn<T>[]
| Required | Column definitions |
| selectable
| boolean
| false
| Enable row selection |
| selectedIds
| readonly string[]
| []
| Controlled selection state |
| onSelectionChange
| (ids: readonly string[]) => void
| - | Selection change handler |
| getRowId
| (row: T, index: number) => string
| (row, index) => String(index)
| Extract unique ID from row |
| sortable
| boolean
| true
| Enable sorting |
| defaultSort
| {column: keyof T, direction: 'asc' | 'desc'}
| - | Initial sort configuration |
| pagination
| boolean
| true
| Enable pagination |
| defaultPageSize
| number
| 5
| Initial page size |
| pageSizeOptions
| number[]
| [5, 10, 25]
| Available page sizes |
| toolbarTitle
| string
| 'Data Table'
| Table title in toolbar |
| bulkActions
| TableAction[]
| - | Custom bulk actions |
| loading
| boolean
| false
| Show loading state |
| emptyMessage
| string
| 'No data available'
| Message when no data |
| onRowClick
| (row: T, index: number) => void
| - | Row click handler |
| variant
| 'outlined' | 'soft' | 'solid' | 'plain'
| 'outlined'
| Table variant |
| size
| 'sm' | 'md' | 'lg'
| 'md'
| Table size |
interface TableColumn<T = any> {
id: keyof T; // Column data key
label: string; // Column header text
numeric?: boolean; // Right-align content
sortable?: boolean; // Enable sorting (default: true)
width?: string | number; // Column width
align?: "left" | "center" | "right"; // Content alignment
render?: (value: any, row: T, index: number) => React.ReactNode; // Custom renderer
}
interface TableAction {
icon: React.ReactNode; // Action icon
tooltip: string; // Tooltip text
onClick: (selectedIds: readonly string[]) => void; // Click handler
color?: "primary" | "neutral" | "danger" | "success" | "warning"; // Action color
variant?: "solid" | "soft" | "outlined" | "plain"; // Action variant
}
const columns: TableColumn<User>[] = [
{
id: "status",
label: "Status",
render: (value: string, row: User) => (
<Chip
color={value === "active" ? "success" : "neutral"}
variant="soft"
size="sm"
>
{value}
</Chip>
),
},
{
id: "actions",
label: "Actions",
sortable: false,
render: (_, row: User) => (
<IconButton size="sm" variant="soft" onClick={() => editUser(row)}>
<EditIcon />
</IconButton>
),
},
];
const bulkActions: TableAction[] = [
{
icon: <DeleteIcon />,
tooltip: "Delete Selected",
onClick: (selectedIds) => {
console.log("Deleting:", selectedIds);
// Implement bulk delete
},
color: "danger",
variant: "solid",
},
{
icon: <ExportIcon />,
tooltip: "Export Selected",
onClick: (selectedIds) => {
console.log("Exporting:", selectedIds);
// Implement bulk export
},
color: "primary",
variant: "outlined",
},
];
function ControlledTable() {
const [selectedUsers, setSelectedUsers] = useState<string[]>([]);
const [currentPage, setCurrentPage] = useState(0);
const [sortConfig, setSortConfig] = useState({
column: "name" as keyof User,
direction: "asc" as const,
});
return (
<CustomTable
data={users}
columns={columns}
selectedIds={selectedUsers}
onSelectionChange={setSelectedUsers}
currentPage={currentPage}
onPageChange={setCurrentPage}
defaultSort={sortConfig}
onSortChange={(column, direction) => setSortConfig({ column, direction })}
/>
);
}
// Loading state
<CustomTable
data={[]}
columns={columns}
loading={true}
toolbarTitle="Loading Users..."
/>
// Empty state
<CustomTable
data={[]}
columns={columns}
emptyMessage="No users found. Try adjusting your search criteria."
toolbarTitle="Users"
/>
<CustomTable
data={data}
columns={columns}
variant="soft"
size="lg"
sx={{
"& .MuiTable-root": {
"--TableCell-headBackground": "#f0f0f0",
"--TableCell-selectedBackground": "#e3f2fd",
},
"& thead th": {
fontWeight: "bold",
borderBottom: "2px solid #ddd",
},
}}
/>
The component is fully typed and supports generic types:
interface Product {
id: string;
name: string;
price: number;
category: string;
}
// Full type safety
const productColumns: TableColumn<Product>[] = [
{
id: "name", // ✅ TypeScript knows this should be keyof Product
label: "Product Name",
render: (name: string, product: Product) => {
// ✅ Proper types inferred
return <strong>{name}</strong>;
},
},
];
<CustomTable<Product>
data={products}
columns={productColumns}
getRowId={(product) => product.id} // ✅ TypeScript knows product type
/>;
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
This package requires the following peer dependencies:
react >= 16.8.0
react-dom >= 16.8.0
@mui/joy >= 5.0.0
@mui/icons-material >= 5.0.0
@mui/utils >= 5.0.0
FAQs
A customizable table component built with MUI Joy and TypeScript
The npm package @manikantsharma/custom-table receives a total of 0 weekly downloads. As such, @manikantsharma/custom-table popularity was classified as not popular.
We found that @manikantsharma/custom-table demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.