Alpha: Building apps with AI is currently in alpha. This feature is subject to change and may have bugs, issues, and limitations. We're actively improving it based on your feedback.
You can override default column rendering in Auto Patterns to customize how columns appear in table components on dashboard pages. In this tutorial, you customize an order status column to display badges with different colors based on the order status value. The order status column displays a standard badge for Processing, a success badge for Shipped and Delivered, an error badge for Canceled, and a neutral badge for other values.
Use the following steps to customize the column with badges:
Create a column component file such as components/columns/orderStatus.tsx. In this file, define a method that receives the column value and returns a React component that displays it as a badge.
The method uses conditional logic to determine the badge color based on the status value:
Processing: standard badgeShipped or Delivered: success badgeCanceled: error badgeCreate an index file such as components/columns/index.tsx that exports your column components.
Import the column overrides in your page component and specify them as the value for PatternsWizardOverridesProvider.
useColumns from your columns directory.useColumns() to get the column overrides.AutoPatternsApp component with PatternsWizardOverridesProvider and pass the columns as the value prop.In your patterns.json configuration file, reference the column override by its field ID. The field ID must match the name of the exported method in your column component. For example, if the field ID is orderStatus in the collection, Auto Patterns automatically uses the orderStatus method from your column overrides. When Auto Patterns renders the table, it uses your custom orderStatus component to display order status column values as badges.