data-grid
БесплатноБез исполняемых скриптовНе проверенMUI X DataGrid configuration, server-side integration, and optimization
от TheLobbi★ 22 звезды на GitHubОб этом скилле
MUI X DataGrid
Package Tiers
| Package | Import | Features |
|---|---|---|
@mui/x-data-grid |
DataGrid |
Sorting, filtering, pagination, export (free, MIT) |
@mui/x-data-grid-pro |
DataGridPro |
Column pinning, row grouping, master-detail, infinite scroll |
@mui/x-data-grid-premium |
DataGridPremium |
Aggregation, pivoting, Excel export, row spanning |
Always import GridColDef and the grid from the same package.
Basic Setup
import { DataGrid, GridColDef } from '@mui/x-data-grid';
import Chip from '@mui/material/Chip';
import Box from '@mui/material/Box';
interface User {
id: number;
name: string;
email: string;
role: string;
createdAt: string;
active: boolean;
}
const columns: GridColDef<User>[] = [
{ field: 'id', headerName: 'ID', width: 80 },
{ field: 'name', headerName: 'Name', width: 180, flex: 1 },
{ field: 'email', headerName: 'Email', width: 220 },
{ field: 'role', headerName: 'Role', width: 120 },
{
field: 'createdAt',
headerName: 'Created',
width: 140,
type: 'date',
valueGetter: (value) => new Date(value), // convert string to Date
valueFormatter: (value: Date) =>
value?.toLocaleDateString('en-US', { dateStyle: 'medium' }),
},
{
field: 'active',
headerName: 'Status',
width: 100,
type: 'boolean',
renderCell: ({ value }) => (
<Chip
label={value ? 'Active' : 'Inactive'}
color={value ? 'success' : 'default'}
size="small"
/>
),
},
];
function UsersGrid({ rows }: { rows: User[] }) {
return (
<Box sx={{ height: 600, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
initialState={{
pagination: { paginationModel: { pageSize: 25 } },
sorting: { sortModel: [{ field: 'createdAt', sort: 'desc' }] },
}}
pageSizeOptions={[10, 25, 50, 100]}
checkboxSelection
disableRowSelectionOnClick
density="compact" // 'compact' | 'standard' | 'comfortable'
getRowId={(row) => row.id} // only needed if row.id is not the key
/>
</Box>
);
}
GridColDef Reference
const col: GridColDef = {
field: 'fieldName', // must match row object key
headerName: 'Display Name',
description: 'Tooltip on header hover',
width: 150, // fixed px width
minWidth: 100,
maxWidth: 300,
flex: 1, // fill remaining space (like CSS flex-grow)
type: 'string', // 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'singleSelect' | 'actions'
align: 'left', // 'left' | 'right' | 'center'
headerAlign: 'left',
sortable: true,
filterable: true,
hideable: true,
pinnable: true, // Pro/Premium only
editable: false,
// Transform raw value for display/sorting (not for renderCell)
valueGetter: (value, row) => `${row.firstName} ${row.lastName}`,
// Format value for display (runs after valueGetter)
valueFormatter: (value: number) => `$${value.toFixed(2)}`,
// Custom cell renderer — receives GridRenderCellParams
renderCell: (params) => (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Avatar src={params.row.avatar} sx={{ width: 24, height: 24 }} />
{params.value}
</Box>
),
// Custom header renderer
renderHeader: (params) => (
<strong>{params.colDef.headerName} <span aria-hidden>*</span></strong>
),
};
Actions column
import { GridActionsCellItem, GridColDef } from '@mui/x-data-grid';
const actionsColumn: GridColDef = {
field: 'actions',
type: 'actions',
headerName: 'Actions',
width: 100,
getActions: (params) => [
<GridActionsCellItem
key="edit"
icon={<EditIcon />}
label="Edit"
onClick={() => handleEdit(params.row)}
/>,
<GridActionsCellItem
key="delete"
icon={<DeleteIcon />}
label="Delete"
onClick={() => handleDelete(params.id)}
showInMenu // show in overflow menu instead of inline
/>,
],
};
Client-Side Sorting, Filtering, Pagination
Client-side is the default. All three happen automatically — just provide rows and
columns. Customise with initialState or controlled props.
import { GridSortModel, GridFilterModel } from '@mui/x-data-grid';
// Controlled sort
const [sortModel, setSortModel] = React.useState<GridSortModel>([
{ field: 'name', sort: 'asc' },
]);
<DataGrid
rows={rows}
columns={columns}
sortModel={sortModel}
onSortModelChange={setSortModel}
/>
// Controlled filter
const [filterModel, setFilterModel] = React.useState<GridFilterModel>({
items: [{ field: 'role', operator: 'equals', value: 'admin' }],
});
<DataGrid
rows={rows}
columns={columns}
filterModel={filterModel}
onFilterModelChange={setFilterModel}
/>
Server-Side Pagination, Sorting, and Filtering
Set `pagina
Установить data-grid в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGlobGrepWriteEditBashFAQ
Что делает скилл data-grid?
MUI X DataGrid configuration, server-side integration, and optimization
Как установить скилл data-grid?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл data-grid запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic