Skip to content

ViewModeSwitcher Component ​

File Information ​

  • Path: app/components/shared/ViewModeSwitcher.vue
  • Purpose: A group of icon buttons that lets the user switch between grid, list, and mosaic view modes. Used on every DAM page that supports more than one view.

Overview ​

ViewModeSwitcher is the canonical, single-source-of-truth toggle for view mode across all DAM pages. It replaces an older, duplicated pattern where each page rendered its own icon buttons.

The component:

  • Renders one v-btn per mode entry in modes, in the order they appear in the array
  • Highlights the active mode with an .active class
  • Shows skeleton chips while loading is true
  • Adapts tooltip behaviour for small screens (isSmallScreen triggers focus-based tooltips)

Each mode maps to a fixed icon, tooltip, and button class via an internal VIEW_MODE_META object:

ModeIconTooltip
gridgridViewIconGrid View
listlistViewIconList View
mosaicmosaicViewIconMosaic View

Props ​

PropTypeDefaultDescription
modelValueViewModerequiredCurrently active mode ('grid', 'list', 'mosaic')
modesViewMode[]['grid', 'list']Which buttons to show and in which order
loadingBooleanfalseRenders skeleton chips instead of buttons
isSmallScreenBooleanfalseActivates focus-based tooltip trigger for touch devices

Events ​

EventPayloadWhen
update:modelValueViewModeUser clicks a mode button

Usage ​

vue
<ViewModeSwitcher
  v-model="viewMode"
  :modes="['grid', 'list', 'mosaic']"
  :loading="contentLoading"
/>

Trash uses ['list', 'grid'] (list first) to match the page's default-list layout.