---
title: "Notifications"
description: "An inbox with unread states and mark-as-read actions."
---

Interactive preview: https://ui.coderocket.app/docs/vue/blocks/notifications

## Usage

Choose Vue in the Studio and export your saved library, or install this item through its connected CLI/MCP. [Vue setup and Nuxt integration](/docs/vue).

```vue
<script setup lang="ts">
import NotificationsBlock from './components/blocks/notifications.vue'
</script>

<!-- Supply the required props and callbacks listed in Source and props. -->
```

## Design system

This Vue component consumes the same CodeRocket tokens as the React version. Import the compiled styles and wrap your app in ThemeScope. Tailwind is optional.

## Behavior and accessibility

Vue uses native events, v-model and slots. Reka UI handles keyboard and focus behavior in complex primitives. Connect actions to your own application and review labels, contrast and mobile behavior in context. Components are experimental during early access.

The full ZIP also includes `examples/block-showcase.vue`, with populated block props, illustrations and local sample callbacks to adapt to your application.

## Source and props

This is the exact Vue single-file component delivered by the export. Related helpers and dependencies are included automatically.

```vue
<script setup lang="ts">
import WorkspaceHeading from "./workspace-heading.vue";
import type { FormAction } from "./common";
import Card from "../ui/card.vue";
import Button from "../ui/button.vue";
import Badge from "../ui/badge.vue";
import { computed } from "vue";
import { CheckCheck, Bell, ChevronRight } from "@lucide/vue";
const props = defineProps<{
  items: Array<{
    id: string;
    title: string;
    description: string;
    time: string;
    unread: boolean;
  }>;
  onReadAll: () => void;
  onOpen: (id: string) => void;
}>();
const unread = computed(() => props.items.filter((item) => item.unread).length);
</script>
<template>
  <Card class="cr-workspace-block cr-workspace-notifications"
    ><WorkspaceHeading
      eyebrow="Your inbox"
      title="Notifications"
      description="The latest from your team and workspace."
      ><template #action
        ><Button
          variant="ghost"
          size="sm"
          :disabled="!unread"
          @click="onReadAll"
          ><CheckCheck :size="16" aria-hidden="true" />Mark all read</Button
        ></template
      ></WorkspaceHeading
    >
    <div class="cr-workspace-list-heading">
      <span>Recent activity</span
      ><Badge :variant="unread ? 'primary' : 'outline'"
        >{{ unread }} unread</Badge
      >
    </div>
    <ul class="cr-workspace-list cr-workspace-notification-list">
      <li v-for="item in items" :key="item.id">
        <button
          type="button"
          class="cr-notification-item cr-workspace-notification"
          :data-unread="item.unread || undefined"
          @click="onOpen(item.id)"
        >
          <span class="cr-workspace-icon-tile"
            ><Bell
              v-if="item.unread"
              :size="18"
              aria-hidden="true" /><CheckCheck
              v-else
              :size="18"
              aria-hidden="true" /></span
          ><span class="cr-workspace-notification-copy"
            ><strong
              >{{ item.title
              }}<template v-if="item.unread"
                ><span aria-hidden="true" class="cr-unread-dot" /><span
                  class="cr-sr-only"
                  >Unread</span
                ></template
              ></strong
            ><span class="cr-description">{{ item.description }}</span
            ><small>{{ item.time }}</small></span
          ><ChevronRight :size="16" aria-hidden="true" />
        </button>
      </li>
    </ul>
    <div v-if="!items.length" class="cr-workspace-caught-up">
      <span class="cr-workspace-icon-tile"
        ><CheckCheck :size="22" aria-hidden="true" /></span
      ><strong>You’re all caught up.</strong>
      <p>New updates will appear here.</p>
    </div></Card
  >
</template>
```
