{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-column-template",
  "framework": "vue",
  "type": "registry:component",
  "component": "Grid",
  "variant": "column-template",
  "dependencies": [
    "@syncfusion/ej2-vue-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/vue/llms.txt",
    "skillPack": "syncfusion/vue-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/vue/grid-column-template.md"
  },
  "files": [
    {
      "target": "src/components/grid-column-template/Grid.vue",
      "content": "<template>\n<div class=\"col-lg-12\">\n  <div class=\"control-section\">\n    <ejs-grid :dataSource=\"data\" height=\"440\" :rowHeight=\"64\" :allowPaging=\"true\" :pageSettings=\"pageSettings\" gridLines=\"Horizontal\">\n      <e-columns>\n        <e-column field=\"OrderID\" headerText=\"Order\" width=\"110\" :template=\"'orderTemplate'\" :isPrimaryKey=\"true\"></e-column>\n        <e-column field=\"CustomerName\" headerText=\"Customer\" width=\"240\" :template=\"'customerTemplate'\"></e-column>\n        <e-column field=\"ShipCity\" headerText=\"Destination\" width=\"150\" :template=\"'destinationTemplate'\"></e-column>\n        <e-column headerText=\"Status\" width=\"150\" :template=\"'statusTemplate'\"></e-column>\n        <e-column field=\"Freight\" headerText=\"Freight\" width=\"120\" format=\"C2\" textAlign=\"Right\"></e-column>\n      </e-columns>\n      <template v-slot:orderTemplate=\"{ data }\">\n        <span style=\"font-family:monospace;font-size:12px;background:#f1f5f9;color:#334155;padding:4px 8px;border-radius:6px\">#{{ data.OrderID }}</span>\n      </template>\n      <template v-slot:customerTemplate=\"{ data }\">\n        <div style=\"display:flex;align-items:center;gap:12px\">\n          <span :style=\"{ background: color(data.CustomerID) }\" style=\"width:38px;height:38px;border-radius:12px;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:13px\">{{ initials(data.CustomerName) }}</span>\n          <div style=\"display:flex;flex-direction:column;justify-content:center\">\n            <span style=\"display:block;font-weight:600;color:#0f172a;line-height:20px\">{{ data.CustomerName }}</span>\n            <span style=\"display:block;font-size:12px;color:#94a3b8;line-height:16px\">{{ data.CustomerID }}</span>\n          </div>\n        </div>\n      </template>\n      <template v-slot:destinationTemplate=\"{ data }\">\n        <div style=\"display:flex;flex-direction:column;justify-content:center\">\n          <span style=\"display:block;color:#0f172a;line-height:20px\">{{ data.ShipCity }}</span>\n          <span style=\"display:block;font-size:12px;color:#94a3b8;line-height:16px\">{{ data.ShipCountry }}</span>\n        </div>\n      </template>\n      <template v-slot:statusTemplate=\"{ data }\">\n        <span :style=\"{ background: status(data).bg, color: status(data).color }\" style=\"border-radius:999px;padding:2px 10px;font-size:12px;font-weight:600\">{{ status(data).label }} · {{ days(data) }}d</span>\n      </template>\n    </ejs-grid>\n  </div>\n</div>\n</template>\n\n<script lang=\"ts\">\nimport { GridComponent, ColumnDirective, ColumnsDirective, Page } from \"@syncfusion/ej2-vue-grids\";\nimport { orderData } from '../datasource/grid-data';\n\nconst palette = ['#6366f1', '#0ea5e9', '#10b981', '#f59e0b', '#ec4899', '#8b5cf6'];\n\nexport default {\n  components: { 'ejs-grid': GridComponent, 'e-column': ColumnDirective, 'e-columns': ColumnsDirective },\n  data: function() {\n    return { data: orderData, pageSettings: { pageSize: 8 } };\n  },\n  methods: {\n    color: (text: string) => palette[[...text].reduce((s, c) => s + c.charCodeAt(0), 0) % palette.length],\n    initials: (name: string) => name.trim().split(/\\s+/).map(p => p[0]).slice(0, 2).join('').toUpperCase(),\n    days: (o: any) => Math.max(0, Math.round((new Date(o.ShippedDate).getTime() - new Date(o.OrderDate).getTime()) / 86400000)),\n    status(o: any) {\n      const d = (this as any).days(o);\n      return d <= 5 ? { label: 'Fast', color: '#059669', bg: '#d1fae5' }\n        : d <= 10 ? { label: 'On time', color: '#0369a1', bg: '#e0f2fe' }\n        : { label: 'Delayed', color: '#b45309', bg: '#fef3c7' };\n    }\n  },\n  provide: { grid: [Page] }\n}\n</script>"
    }
  ]
}