NuxtN
Nuxt5mo ago
4 replies
i.wont.tell

How to hide columns with UTable?

I'm trying with
<script setup lang="ts">
import { ref } from "vue";

const columns = [
  { id: "id", accessorKey: "id", header: "ID"},
  { id: "name", accessorKey: "name", header: "Name" }
];

const data = ref([
  { id: 1, name: "Something" },
  { id: 2, name: "AnotherThing" }
]);
</script>

<template>
  <UTable
    :columns="columns"
    :data="data"
    :initial-state="{ columnVisibility: { id: false } }"
  />
</template>


but it doesn't work, ID is still shown. I have also tried with :state instead and it's the same. I'm using UI v3 Nuxt v4
Was this page helpful?