{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-column-template",
  "framework": "react",
  "type": "registry:component",
  "component": "Grid",
  "variant": "column-template",
  "dependencies": [
    "@syncfusion/ej2-react-grids"
  ],
  "description": "Data grid with a column template that renders each customer as an avatar with initials, a tinted color, and a delivery status badge.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/js/grid-column-template.md"
  },
  "files": [
    {
      "target": "src/components/grid-column-template/Grid.jsx",
      "content": "import { GridComponent, ColumnsDirective, ColumnDirective, Inject, Page } from '@syncfusion/ej2-react-grids';\nimport { orderDetails } from '../datasource/grid-data';\n\nconst palette = ['#6366f1', '#0ea5e9', '#10b981', '#f59e0b', '#ec4899', '#8b5cf6'];\nconst colorFor = (text) => palette[[...text].reduce((sum, ch) => sum + ch.charCodeAt(0), 0) % palette.length];\nconst initials = (name) => name.trim().split(/\\s+/).map((p) => p[0]).slice(0, 2).join('').toUpperCase();\nconst daysToShip = (o) => Math.max(0, Math.round((new Date(o.ShippedDate) - new Date(o.OrderDate)) / 86400000));\nconst statusOf = (days) => (days <= 5 ? { label: 'Fast', color: '#059669', bg: '#d1fae5' }\n  : days <= 10 ? { label: 'On time', color: '#0369a1', bg: '#e0f2fe' }\n  : { label: 'Delayed', color: '#b45309', bg: '#fef3c7' });\n\nconst idStyle = { fontFamily: 'monospace', fontSize: 12, background: '#f1f5f9', color: '#334155', padding: '4px 8px', borderRadius: 6 };\nconst avatarStyle = { width: 38, height: 38, borderRadius: 12, color: '#fff', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontWeight: 600, fontSize: 13 };\nconst stackStyle = { display: 'flex', flexDirection: 'column', justifyContent: 'center' };\nconst mainLine = { display: 'block', color: '#0f172a', lineHeight: '20px' };\nconst subLine = { display: 'block', fontSize: 12, color: '#94a3b8', lineHeight: '16px' };\nconst chipStyle = { borderRadius: 999, padding: '2px 10px', fontSize: 12, fontWeight: 600 };\n\nfunction ColumnTemplate() {\n  const orderTemplate = (p) => <span style={idStyle}>#{p.OrderID}</span>;\n  const customerTemplate = (p) => {\n    const name = p.CustomerName.trim();\n    return (\n      <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>\n        <span style={{ ...avatarStyle, background: colorFor(p.CustomerID) }}>{initials(name)}</span>\n        <div style={stackStyle}>\n          <span style={{ ...mainLine, fontWeight: 600 }}>{name}</span>\n          <span style={subLine}>{p.CustomerID}</span>\n        </div>\n      </div>\n    );\n  };\n  const destinationTemplate = (p) => (\n    <div style={stackStyle}>\n      <span style={mainLine}>{p.ShipCity}</span>\n      <span style={subLine}>{p.ShipCountry}</span>\n    </div>\n  );\n  const statusTemplate = (p) => {\n    const days = daysToShip(p);\n    const s = statusOf(days);\n    return <span style={{ ...chipStyle, background: s.bg, color: s.color }}>{s.label} · {days}d</span>;\n  };\n\n  return (\n    <div className='control-pane'>\n      <div className='control-section'>\n        <GridComponent dataSource={orderDetails} height='440' rowHeight={64} allowPaging={true}\n          pageSettings={{ pageSize: 8 }} gridLines='Horizontal'>\n          <ColumnsDirective>\n            <ColumnDirective field='OrderID' headerText='Order' width='110' template={orderTemplate} isPrimaryKey={true} />\n            <ColumnDirective field='CustomerName' headerText='Customer' width='220' template={customerTemplate} />\n            <ColumnDirective field='ShipCity' headerText='Destination' width='150' template={destinationTemplate} />\n            <ColumnDirective headerText='Status' width='150' template={statusTemplate} />\n            <ColumnDirective field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' />\n          </ColumnsDirective>\n          <Inject services={[Page]} />\n        </GridComponent>\n      </div>\n    </div>\n  );\n}\nexport default ColumnTemplate;"
    }
  ]
}