Layout e grids

VDashboardWidgetGrid

Componente7 exemplos9 props

Grelha de dashboard de 2 dimensões. Cada `VDashboardWidget` ocupa uma célula (`x`, `y`) com um span (`w` × `h`) e a grade resolve colisões e compactação vertical por si. No **modo de edição** os widgets podem ser arrastados pelo ícone de pega, redimensionados pelo canto inferior direito e movidos/redimensionados pelo teclado (setas movem; Shift + setas redimensionam).

Importação
<script setup lang="ts">
import { VDashboardWidgetGrid } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<template>
  <VDashboardWidgetGrid
    :widgets="widgets"
    :cols="12"
    :row-height="128"
    @update:layout="onLayoutChange" />
</template>

Playground

Os controles abaixo são gerados a partir das props declaradas em VDashboardWidgetGrid.types.ts; o código acompanha cada mudança.

Exemplos

Variantes, tamanhos e estados, extraídos das stories da biblioteca.

Default

Dashboard analítico em uma grade de 12 colunas. Cada widget declara a posição (x, y) e o tamanho (w × h) em unidades de célula; a altura da célula vem de rowHeight. Clique em Edit layout para ativar o arrasto e o redimensionamento.

Ver código
vue
<script setup lang="ts">
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: 12,
  rowHeight: 128,
  gap: 4,
  editMode: false
}
const widgets = [
  {
    id: 'revenue',
    title: 'Receita total',
    kind: 'revenue',
    x: 0,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'users',
    title: 'Usuários ativos',
    kind: 'users',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'activity',
    title: 'Atividade recente',
    kind: 'activity',
    x: 8,
    y: 0,
    w: 4,
    h: 4
  },
  {
    id: 'tasks',
    title: 'Tarefas',
    kind: 'tasks',
    x: 0,
    y: 2,
    w: 4,
    h: 2
  },
  {
    id: 'traffic',
    title: 'Tráfego do site',
    kind: 'traffic',
    x: 4,
    y: 2,
    w: 4,
    h: 2
  }
]
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
</script>

<template>
      <div class="demo-page">
        <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
        <VDashboardWidgetGrid v-bind="args">
          <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h" :locked="w.locked">
            
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
          </VDashboardWidget>
        </VDashboardWidgetGrid>
      </div>
</template>

Edit Mode

Modo de edição ativo (editMode). Arraste um widget pela alça do cabeçalho para reordená-lo: os demais widgets são empurrados e recompactados. Redimensione pelo canto inferior direito; o span encaixa na grade de pontos. Com um widget focado, as setas o movem e Shift + setas o redimensionam.

Ver código
vue
<script setup lang="ts">
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: 12,
  rowHeight: 128,
  gap: 4,
  editMode: true
}
const widgets = [
  {
    id: 'revenue',
    title: 'Receita total',
    kind: 'revenue',
    x: 0,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'users',
    title: 'Usuários ativos',
    kind: 'users',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'activity',
    title: 'Atividade recente',
    kind: 'activity',
    x: 8,
    y: 0,
    w: 4,
    h: 4
  },
  {
    id: 'tasks',
    title: 'Tarefas',
    kind: 'tasks',
    x: 0,
    y: 2,
    w: 4,
    h: 2
  },
  {
    id: 'traffic',
    title: 'Tráfego do site',
    kind: 'traffic',
    x: 4,
    y: 2,
    w: 4,
    h: 2
  }
]
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
</script>

<template>
      <div class="demo-page">
        <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
        <VDashboardWidgetGrid v-bind="args">
          <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h" :locked="w.locked">
            
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
          </VDashboardWidget>
        </VDashboardWidgetGrid>
      </div>
</template>

Interactive

Dashboard totalmente controlado: v-model:layout guarda o layout, @close remove o widget (×) e @add insere o próximo widget disponível no fim da grade. Em produção, persista o layout (por exemplo em localStorage) para restaurar as preferências do usuário.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: 12,
  rowHeight: 128,
  gap: 4,
  editMode: true
}
const widgets = ref([
  {
    id: 'revenue',
    title: 'Receita total',
    kind: 'revenue',
    x: 0,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'users',
    title: 'Usuários ativos',
    kind: 'users',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'activity',
    title: 'Atividade recente',
    kind: 'activity',
    x: 8,
    y: 0,
    w: 4,
    h: 4
  },
  {
    id: 'tasks',
    title: 'Tarefas',
    kind: 'tasks',
    x: 0,
    y: 2,
    w: 4,
    h: 2
  },
  {
    id: 'traffic',
    title: 'Tráfego do site',
    kind: 'traffic',
    x: 4,
    y: 2,
    w: 4,
    h: 2
  }
])
const layout = ref([
  {
    id: 'revenue',
    x: 0,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'users',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'activity',
    x: 8,
    y: 0,
    w: 4,
    h: 4
  },
  {
    id: 'tasks',
    x: 0,
    y: 2,
    w: 4,
    h: 2
  },
  {
    id: 'traffic',
    x: 4,
    y: 2,
    w: 4,
    h: 2
  }
])
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
const add = function add() {
        const next = catalog.find((c) => !widgets.value.some((w) => w.id === c.id));
        if (!next) return;
        widgets.value = [...widgets.value, { ...next }];
        layout.value = [...layout.value, { id: next.id, x: next.x, y: next.y, w: next.w, h: next.h }];
      }
const remove = function remove(id) {
        widgets.value = widgets.value.filter((w) => w.id !== id);
        layout.value = layout.value.filter((l) => l.id !== id);
      }
</script>

<template>
        <div class="demo-page">
          <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
          <VDashboardWidgetGrid v-bind="args" v-model:layout="layout" @add="add">
            <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h" @close="remove(w.id)">
              
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
            </VDashboardWidget>
          </VDashboardWidgetGrid>
        </div>
</template>

Sizes

Tamanhos de widget em unidades da grade: SM 3 × 1, MD 4 × 2 e LG 6 × 2. O corpo do widget rola quando o conteúdo excede a altura.

Ver código
vue
<script setup lang="ts">
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: 12,
  rowHeight: 128,
  gap: 4,
  editMode: false
}
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
const widgets = [
  {
    id: 'sm',
    title: 'SM · 3 × 1',
    kind: 'status',
    x: 0,
    y: 0,
    w: 3,
    h: 1
  },
  {
    id: 'md',
    title: 'MD · 4 × 2',
    kind: 'revenue',
    x: 3,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'lg',
    title: 'LG · 6 × 2',
    kind: 'activity',
    x: 6,
    y: 0,
    w: 6,
    h: 2
  },
  {
    id: 'goal',
    title: 'SM · 3 × 1',
    kind: 'goal',
    x: 0,
    y: 1,
    w: 3,
    h: 1
  }
]
</script>

<template>
      <div class="demo-page">
        <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
        <VDashboardWidgetGrid v-bind="args">
          <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h" :locked="w.locked">
            
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
          </VDashboardWidget>
        </VDashboardWidgetGrid>
      </div>
</template>

Locked Widget

Um widget com locked mostra um cadeado, não tem pegas e não pode ser movido, redimensionado nem removido; os outros widgets reorganizam-se à sua volta. disabled desativa o widget por completo.

Ver código
vue
<script setup lang="ts">
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: 12,
  rowHeight: 128,
  gap: 4,
  editMode: true
}
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
const widgets = [
  {
    id: 'goal',
    title: 'Progresso da equipe',
    kind: 'goal',
    x: 0,
    y: 0,
    w: 4,
    h: 3,
    locked: true
  },
  {
    id: 'revenue',
    title: 'Receita total',
    kind: 'revenue',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'status',
    title: 'Estado dos serviços',
    kind: 'status',
    x: 8,
    y: 0,
    w: 4,
    h: 2
  }
]
</script>

<template>
      <div class="demo-page">
        <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
        <VDashboardWidgetGrid v-bind="args">
          <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h" :locked="w.locked">
            
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
          </VDashboardWidget>
        </VDashboardWidgetGrid>
      </div>
</template>

Responsive Columns

cols aceita um mapa por breakpoint ({ default: 1, sm: 4, md: 8, lg: 12 }) avaliado contra a largura da própria grade, não do tela. Arraste o canto inferior direito do container para estreitá-lo: os widgets são limitados às colunas disponíveis e se empilham.

Ver código
vue
<script setup lang="ts">
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: {
    default: 1,
    sm: 4,
    md: 8,
    lg: 12
  },
  rowHeight: 128,
  gap: 4,
  editMode: false
}
const widgets = [
  {
    id: 'revenue',
    title: 'Receita total',
    kind: 'revenue',
    x: 0,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'users',
    title: 'Usuários ativos',
    kind: 'users',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'activity',
    title: 'Atividade recente',
    kind: 'activity',
    x: 8,
    y: 0,
    w: 4,
    h: 4
  },
  {
    id: 'tasks',
    title: 'Tarefas',
    kind: 'tasks',
    x: 0,
    y: 2,
    w: 4,
    h: 2
  },
  {
    id: 'traffic',
    title: 'Tráfego do site',
    kind: 'traffic',
    x: 4,
    y: 2,
    w: 4,
    h: 2
  }
]
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
</script>

<template>
        <div class="demo-page">
          <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
          <div style="resize:horizontal;overflow:auto;width:100%;max-width:100%;min-width:280px;border-right:2px dashed var(--v-color-border)">
            <VDashboardWidgetGrid v-bind="args">
              <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h">
                
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
              </VDashboardWidget>
            </VDashboardWidgetGrid>
          </div>
        </div>
</template>

Compact Variant

Variante compact: linhas mais baixas (rowHeight=100) e espaçamento reduzido para maior densidade de informação.

Ver código
vue
<script setup lang="ts">
import { VDashboardWidgetGrid, VDashboardWidget, VIcon, VBadge, VGroupAvatar, VProgress, VAvatar } from 'vueui-nova-kit'

const args = {
  cols: 12,
  rowHeight: 100,
  gap: 2,
  editMode: false,
  variant: 'compact'
}
const widgets = [
  {
    id: 'revenue',
    title: 'Receita total',
    kind: 'revenue',
    x: 0,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'users',
    title: 'Usuários ativos',
    kind: 'users',
    x: 4,
    y: 0,
    w: 4,
    h: 2
  },
  {
    id: 'activity',
    title: 'Atividade recente',
    kind: 'activity',
    x: 8,
    y: 0,
    w: 4,
    h: 4
  },
  {
    id: 'tasks',
    title: 'Tarefas',
    kind: 'tasks',
    x: 0,
    y: 2,
    w: 4,
    h: 2
  },
  {
    id: 'traffic',
    title: 'Tráfego do site',
    kind: 'traffic',
    x: 4,
    y: 2,
    w: 4,
    h: 2
  }
]
const icons = {
  dollar: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M12 2L12 22M16 4L10 4C7.7909 4 6 5.7909 6 8C6 10.2091 7.7909 12 10 12L14 12C16.2091 12 18 13.7909 18 16C18 18.2091 16.2091 20 14 20L8 20\'/>'
  },
  users: {
    width: 24,
    height: 24,
    body: '<path fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\' d=\'M8 14H10C13.3137 14 16 16.6863 16 20C16 20.5523 15.5523 21 15 21H3C2.44772 21 2 20.5523 2 20C2 16.6863 4.68629 14 8 14ZM9 4C10.6569 4 12 5.34315 12 7C12 8.65685 10.6569 10 9 10C7.34315 10 6 8.65685 6 7C6 5.34315 7.34315 4 9 4ZM16 4C17.6569 4 19 5.34315 19 7C19 8.65685 17.6569 10 16 10M18.3333 14.4713C20.554 15.409 22 17.589 22 20C22 20.5523 21.5523 21 21 21\'/>'
  },
  check: {
    width: 24,
    height: 24,
    body: '<g fill=\'none\' stroke=\'currentColor\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'2\'><path d=\'M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z\'/><path d=\'M8 12L10.6667 15L16 9\'/></g>'
  }
}
</script>

<template>
      <div class="demo-page">
        <component :is="'style'">
    .demo-kpi { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-kpi__icon { display:inline-grid; place-items:center; width:40px; height:40px; border-radius:var(--v-radius-md); background:var(--v-color-surface-muted); color:var(--v-color-primary); }
    .demo-kpi__value { font-size:var(--v-font-size-h2); font-weight:var(--v-font-weight-semibold); line-height:1.1; margin-bottom:var(--v-space-1); }
    .demo-spark { width:100%; height:40px; margin-top:var(--v-space-3); }
    .demo-list { display:flex; flex-direction:column; gap:var(--v-space-3); }
    .demo-feed, .demo-tasks { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--v-space-3); font-size:var(--v-font-size-text-small); }
    .demo-feed li { display:flex; align-items:center; gap:var(--v-space-3); }
    .demo-feed__text { flex:1; min-width:0; }
    .demo-feed__time { color:var(--v-color-text-muted); white-space:nowrap; }
    .demo-tasks { margin-top:var(--v-space-3); gap:var(--v-space-2); }
    .demo-tasks li { display:flex; align-items:center; gap:var(--v-space-2); }
    .demo-tasks li[data-done='true'] { color:var(--v-color-text-muted); text-decoration:line-through; }
    .demo-center { display:grid; place-items:center; height:100%; }
    .demo-badges { display:flex; flex-wrap:wrap; gap:var(--v-space-2); }
    .demo-page { padding:var(--v-space-4); }
  </component>
        <VDashboardWidgetGrid v-bind="args">
          <VDashboardWidget v-for="w in widgets" :key="w.id" :id="w.id" :title="w.title" :x="w.x" :y="w.y" :w="w.w" :h="w.h" :locked="w.locked">
            
    <template v-if="w.kind === 'revenue'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.dollar" /></span>
        <div>
          <div class="demo-kpi__value">€24.780</div>
          <VBadge variant="success" size="sm">+12% vs. mês anterior</VBadge>
        </div>
      </div>
      <svg class="demo-spark" viewBox="0 0 120 32" preserveAspectRatio="none" aria-hidden="true">
        <polyline points="0,26 14,22 28,24 42,16 56,18 70,10 84,14 98,6 120,3" fill="none" stroke="var(--v-color-primary)" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" vector-effect="non-scaling-stroke" />
      </svg>
    </template>
    <template v-else-if="w.kind === 'users'">
      <div class="demo-kpi">
        <span class="demo-kpi__icon"><VIcon :icon="icons.users" /></span>
        <div>
          <div class="demo-kpi__value">8.421</div>
          <VBadge variant="success" size="sm">+8%</VBadge>
        </div>
      </div>
      <VGroupAvatar :members="[{ initials: 'SC' }, { initials: 'AL' }, { initials: 'JP' }, { initials: 'MR' }, { initials: 'TK' }]" :max="4" size="sm" />
    </template>
    <template v-else-if="w.kind === 'traffic'">
      <div class="demo-list">
        <div v-for="s in [['Pesquisa orgânica', 64], ['Direto', 22], ['Redes sociais', 14]]" :key="s[0]">
          <VProgress :value="s[1]" size="sm" :label="s[0] + ' · ' + s[1] + '%'" />
        </div>
      </div>
    </template>
    <template v-else-if="w.kind === 'activity'">
      <ul class="demo-feed">
        <li v-for="a in [['Sarah Chen', 'criou um projeto', '2 min'], ['Alex Lima', 'atualizou o design system', '12 min'], ['João Pires', 'se cadastrou', '28 min'], ['Marta Reis', 'concluiu o backup', '1 h'], ['Tiago Kane', 'publicou a v1.2.0', '2 h']]" :key="a[0]">
          <VAvatar :initials="a[0].split(' ').map((n) => n[0]).join('')" size="sm" />
          <span class="demo-feed__text"><strong>{{ a[0] }}</strong> {{ a[1] }}</span>
          <span class="demo-feed__time">{{ a[2] }}</span>
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'tasks'">
      <VProgress :value="60" size="md" label="3 de 5 concluídas" />
      <ul class="demo-tasks">
        <li v-for="t in [['Finalizar design', true], ['Implementar a grade', true], ['Escrever documentação', true], ['Adicionar testes', false]]" :key="t[0]" :data-done="t[1]">
          <VIcon :icon="icons.check" size="sm" /> {{ t[0] }}
        </li>
      </ul>
    </template>
    <template v-else-if="w.kind === 'goal'">
      <div class="demo-center"><VProgress variant="circular" :value="78" label="78%" /></div>
    </template>
    <template v-else-if="w.kind === 'status'">
      <div class="demo-badges">
        <VBadge variant="success" dot>API operacional</VBadge>
        <VBadge variant="warning" dot>Fila de e-mails lenta</VBadge>
        <VBadge variant="primary" dot>Deploy em curso</VBadge>
        <VBadge variant="danger" dot>Webhook falhou</VBadge>
      </div>
    </template>
  
          </VDashboardWidget>
        </VDashboardWidgetGrid>
      </div>
</template>

Acessibilidade

  1. Keyboard navigation (Tab, Arrow keys) — (ambas as páginas) navegação sequencial e por setas entre widgets.
  2. ARIA roles for grid and widgets / ARIA roles and labels — role="grid", role="gridcell"/article, aria-label do widget.
  3. Focusable drag and resize handles — pegas focáveis e operáveis por teclado.
  4. Resizable via keyboard (Shift + Arrow) — (página 2) redimensionar com Shift + setas.
  5. Screen reader announcements / Screen reader friendly — mudanças de layout anunciadas via aria-live.
  6. Visible focus states — anel de foco sempre visível.
  7. Sufficient color contrast — texto e indicadores com contraste suficiente.
  8. Works with assistive technologies — compatível com tecnologias de apoio.
  9. Respects / Supports reduced motion preference — prefers-reduced-motion: reduce desliga animações.

Props

PropTipoDefaultDescrição
colsVGridCols12Number of columns, or a breakpoint map resolved against the grid's own width (e.g. `{ default: 1, sm: 4, lg: 12 }`).
rowHeightnumber128—
gapnumber4—
variantVDashboardWidgetGridVariant"freeform"—
editModebooleanfalse—
layoutVDashboardWidgetLayoutItem[]—Controlled layout (`v-model:layout`). Items matched to widgets by `id` override the widget's own x/y/w/h.
addLabelstring"+ Add widget"Label of the built-in toolbar "add" button.
hideToolbarbooleanfalseHides the built-in toolbar (use the `toolbar` slot or external controls).
ariaLabelstring——

Events

EventoPayloadDescrição
@update:layoutlayout: VDashboardWidgetLayoutItem[]—
@update:editModeeditMode: boolean—
@add—The toolbar "+ Add widget" button was pressed.

Slots

SlotProps do slot
#toolbaredit-modetoggleadd
#default—

Fonte: src/components/grid/VDashboardWidgetGrid/VDashboardWidgetGrid.vue · tipos: src/components/grid/VDashboardWidgetGrid/VDashboardWidgetGrid.types.ts