Skip to content
LIBRARYBase

ListItem ​

MListItem organizes a title, description and side content. Use informational rows for data, or interactive for one action across the whole surface.

Next alpha

Available in 0.1.0-alpha.4.

Web preview
Open example ↗

Usage ​

vue
<m-list-item title="Marina Costa" description="Design · São Paulo" interactive
  accessibilityLabel="Open Marina Costa, Design, available" @click="openMember">
  <template #leading><m-avatar name="Marina Costa" :accessibilityHidden="true" /></template>
  <template #trailing><m-badge text="Available" tone="success" size="sm" /></template>
</m-list-item>

The app owns openMember. The row emits click without a payload; it does not choose a route, selection or opening policy.

Props ​

PropTypeDefaultBehavior
titlestringrequiredNon-empty title; wraps.
descriptionstring''Secondary text, also wraps.
interactivebooleanfalseTurns the surface into one action.
disabledbooleanfalseBlocks only the interactive row's action.
widthnumber | % | autoautoWidth following the layout contract.
grow / shrinknumber0 / contextLayout participation.
accessibilityLabelstringtitle + descriptionInteractive row name. Include meaningful slot content.
accessibilityHiddenbooleanfalseHides redundant content.
idstring—Optional identifier.

Slots and interaction ​

leading accepts an avatar or icon; trailing, compact information or a control. There is no default slot: title and description are props. An interactive row without trailing shows chevron-right; providing that slot replaces the arrow.

Interactive row: one action, with focus and Enter/Space on Web and Jolt press feedback on native. The default chevron leans toward where the row leads: on Web when the pointer rests on the row or the row has keyboard focus, further while it is pressed; on native while a finger holds the row. It settles back when the gesture ends; with reduced motion it moves without travelling. A trailing slot replaces the chevron and its motion. Do not nest buttons, links or fields in its slots. The default accessible name combines title and description; supply accessibilityLabel when a Badge or other side element adds meaning. Native children are hidden as separate assistive targets.

Informational row: does not take focus or emit click. Children retain their own text and semantics. An independent button can go in trailing; disabled does not disable that control. The row is not automatically combined into one accessible element.

The composition reuses Card, Row, Column, Text and Icon: theme surface, md padding, md radius and no border. Height follows text. Keep side slots compact; large side content competes with the title for space. Compose your own Card for forms or complex content. At the largest system text sizes, an avatar and a long trailing badge can leave the title wrapping inside words. The row grows instead of truncating it; use a compact trailing icon or a vertical composition when that layout is unsuitable.

Group a few rows in Column/Card with Separator between them. This component does not provide a virtualized collection, swipe actions, reordering or selection management. Team demonstrates details in Sheet and favorites owned by the parent.

Full example ​

View source
vue
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
import { computed, ref } from 'vue'
import { useMavisTheme } from '@getcortexlabs/mavis-core/vue'

const { t, locale } = useCatalogLocale(() => props.lang)

const props = withDefaults(defineProps<{ lang?: 'en' | 'pt' }>(), { lang: undefined })

const pt = computed(() => (props.lang ?? locale.value) === 'pt')
const { theme } = useMavisTheme()
const selected = ref('')
const saved = ref(false)
</script>

<template>
  <m-column gap="lg">
    <m-column padding="lg" gap="md" radius="lg" :backgroundColor="theme.colors.accentSoft">
      <m-text variant="overline" tone="accent">{{
        t(pt ? 'CADA LINHA, UMA HISTÓRIA' : 'A STORY IN EVERY ROW')
      }}</m-text>
      <m-text variant="title">{{
        t(pt ? 'Tudo encontra seu lugar.' : 'Everything in its place.')
      }}</m-text>
      <m-text tone="muted">{{
        t(pt ? 'Pessoas, ideias e próximos passos.' : 'People, ideas and next steps.')
      }}</m-text>
    </m-column>
    <m-card :padding="0">
      <m-list-item
        :title="t('Marina Costa')"
        :description="t('Design · São Paulo')"
        interactive
        :accessibilityLabel="
          t(pt ? 'Abrir Marina Costa, Design, disponível' : 'Open Marina Costa, Design, available')
        "
        @click="selected = 'Marina Costa'"
      >
        <template #leading><m-avatar name="Marina Costa" :accessibilityHidden="true" /></template>
        <template #trailing
          ><m-badge :text="t(pt ? 'Disponível' : 'Available')" tone="success" size="sm"
        /></template>
      </m-list-item>
      <m-separator inset="md" />
      <m-list-item
        :title="t(pt ? 'Biblioteca de ideias' : 'Idea library')"
        :description="t(pt ? 'Um lugar para o que inspira você.' : 'A home for what inspires you.')"
        interactive
        @click="selected = pt ? 'Biblioteca de ideias' : 'Idea library'"
      >
        <template #leading><m-icon name="book-open" tone="accent" /></template>
      </m-list-item>
      <m-separator inset="md" />
      <m-list-item
        :title="t(pt ? 'Arquivo da equipe' : 'Team archive')"
        :description="t(pt ? 'Disponível em breve.' : 'Coming soon.')"
        interactive
        disabled
        @click="selected = 'disabled'"
      >
        <template #leading><m-icon name="archive" tone="muted" /></template>
      </m-list-item>
    </m-card>
    <m-text id="list-selection" variant="caption" tone="muted">{{
      t(
        selected
          ? pt
            ? `Selecionado: ${selected}`
            : `Selected: ${selected}`
          : pt
            ? 'Escolha uma linha para continuar.'
            : 'Choose a row to continue.',
      )
    }}</m-text>
    <m-list-item
      :title="t(pt ? 'Guarde para depois' : 'Save for later')"
      :description="t(pt ? 'A ação fica no botão ao lado.' : 'The button owns this action.')"
    >
      <template #trailing>
        <m-button
          variant="ghost"
          size="sm"
          :icon="saved ? 'check' : 'bookmark'"
          :accessibilityLabel="
            t(
              saved
                ? pt
                  ? 'Remover favorito'
                  : 'Remove favorite'
                : pt
                  ? 'Favoritar'
                  : 'Add favorite',
            )
          "
          @click="saved = !saved"
        />
      </template>
    </m-list-item>
  </m-column>
</template>

Desktop ​

On the Mac and on Windows an interactive item is one native button that reads its title and description, with the leading and trailing slots beside them; a plain item is a group of text. Both hosts behave the same. See Desktop components.

Components for NativeScript and Web. Starting with Vue.