Configure View Configurations
In this guide, you'll learn how to configure the data tables that use view configurations in the dashboard. You'll learn how to set the default columns and their order, add computed columns, change how a column's value renders, and show a configurable data table in your admin customizations.
How Column Configurations are Generated#
The Settings Module discovers the entities in your application from the registered modules' query graph, including your custom modules' data models. For each entity, it generates the column configurations that are used in its configurable data table in the Medusa Admin dashboard.
You can then override these generated column configurations, as explained in the following sections. You can change the default visible columns, their order, how their values render, and add computed columns.
Product or a custom one like Brand.How to Override Entity Column Configurations#
In the Settings Module's configurations, you can override the generated columns of a core or custom data model. These overrides are applied to the configurable data table in the Medusa Admin dashboard when the view configuration feature is enabled, and only to the system default view configuration.
In this section, you'll learn how to configure the default columns of a custom data model Brand defined in a custom module. You can use the same approach to configure the default columns of any core or custom data model. The sections after this one explain all the different configuration overrides you can set for an entity's columns.
Default Column Render Modes#
The Settings Module infers how to render each column's value, which is used to decide the column's render mode. The Medusa Admin dashboard defines cell renderers for these render modes, which are used to render the column's value in the configurable data table.
The Settings Module and Medusa Admin dashboard support the following built-in render modes:
Render Mode | Description |
|---|---|
| Shows the value as plain text. |
| Formats the value as a localized number. |
| Formats the value as a price using the same row's |
| Formats the value as a date. |
| Shows the value as a Yes or No badge. |
| Shows the value as a |
| Shows the value as a |
| Shows the value as an external link. |
| Shows the value as an image. |
| Shows the value as formatted JSON. |
| Shows the value as a URL path prefixed with |
| Shows the number of items in the array specified in the entity configuration's |
| Shows the items in the array specified in the entity configuration's |
| Shows a status pill resolved from the entity configuration's |
| Shows a full name from the |
| Shows a formatted address from the object at the entity configuration's |
| Shows a country flag from the code at the entity configuration's |
How Render Modes are Inferred#
By default, the Settings Module infers how to render a column's value in the following order of precedence:
- Name checking: It applies the following name checks and assigns the corresponding render mode if the field name matches:
*_at/created_at/updated_at/deleted_at→datetime*_date→date*total/*amount/*price/subtotal/tax_total/shipping_total/discount_total→currency*status/state/payment_status/fulfillment_status→statusemail/*_email→emailphone/*_phone→phone*country_code→country_codeurl/*_url→urlthumbnail/avatar/*_image→imageid/*_id→iddisplay_id→display_idcount/*_count/*quantity→numberis_*/has_*/can_*→booleanmetadata→json
- Type checking: If the field name doesn't match any of the above, it checks the field's type and assigns the corresponding render mode:
boolean→booleantext→textnumber→numberdateTime→datetimejson→jsonid→id
- Fallback: If the field name and type don't match any of the above, it defaults to
text.