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.

Glossary: In this guide, the terms "entity" and "data model" are used interchangeably. They both refer to a data model defined in a module, such as a core data model like 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.

Tip: Admin users can still customize the columns of a data table in the dashboard, and their customizations are saved either as system default or user-specific view configurations. The overrides you define here are applied only if the user hasn't customized the columns of the data table.

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

text

Shows the value as plain text.

number

Formats the value as a localized number.

currency

Formats the value as a price using the same row's currency_code property.

date, datetime, or timestamp

Formats the value as a date.

boolean

Shows the value as a Yes or No badge.

email

Shows the value as a mailto: link.

phone

Shows the value as a tel: link.

url

Shows the value as an external link.

image

Shows the value as an image.

json

Shows the value as formatted JSON.

handle

Shows the value as a URL path prefixed with /.

count

Shows the number of items in the array specified in the entity configuration's metadata.list_field.

badges

Shows the items in the array specified in the entity configuration's metadata.list_field as badges. The label of the badges is determined by metadata.display_field.

status

Shows a status pill resolved from the entity configuration's metadata.resolver or metadata.status_variants.

name

Shows a full name from the first_name and last_name fields at the entity configuration's metadata.name_source.

address

Shows a formatted address from the object at the entity configuration's metadata.address_field.

country_code

Shows a country flag from the code at the entity configuration's metadata.country_code_field.

How Render Modes are Inferred#

By default, the Settings Module infers how to render a column's value in the following order of precedence:

  1. 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 → status
    • email / *_email → email
    • phone / *_phone → phone
    • *country_code → country_code
    • url / *_url → url
    • thumbnail / avatar / *_image → image
    • id / *_id → id
    • display_id → display_id
    • count / *_count / *quantity → number
    • is_* / has_* / can_* → boolean
    • metadata → json
  2. 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 → boolean
    • text → text
    • number → number
    • dateTime → datetime
    • json → json
    • id → id
  3. Fallback: If the field name and type don't match any of the above, it defaults to text.
Found a problem with this page?Report Issue
Edited Nov 14·Edit this page