npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@desource/context7-widget-nuxt

v0.2.0

Published

Nuxt 3 and Nuxt 4 module for the native Vue Context7 documentation chat widget.

Readme

@desource/context7-widget-nuxt

Nuxt Coverage SonarCloud License

Add Context7 docs chat to Nuxt 3 or 4 and style it to match your site. This MIT-licensed module sets up the native Vue widget, its stylesheet, auto-imports, and app-wide defaults.

Why Use This Widget?

Context7 provides its docs widget and hosted AI answers for free. Its basic styling can leave chat looking out of place. This upgrade adds fonts, colors, custom triggers, and layouts to match your site, plus copyable code, multiline input, Stop, and Retry.

Upgrade your existing script or add the module below with the same library and domain settings. New to Context7? Help visitors explore your library and start their first integration. The module reuses Vue and the shared core.

Before You Start

Use a library you have claimed on Context7. In its Admin → Chat settings, enable the widget, add your site's domain to the allowed domains, and save. Replace /owner/repo in the examples with that library's id. A library being indexed alone does not enable chat on your site. See Context7's widget setup.

Install

pnpm add @desource/context7-widget-nuxt

Add the module and configure the documentation library once:

export default defineNuxtConfig({
  modules: ['@desource/context7-widget-nuxt'],
  context7Widget: {
    defaults: {
      library: '/owner/repo'
    }
  }
});

Context7Widget and useContext7Widget are now available without imports. The stylesheet is added before application CSS so application rules can override it.

Examples

Render the widget

<template>
  <Context7Widget />
</template>

Props override module defaults for that instance:

<template>
  <Context7Widget
    library="/owner/another-repo"
    position="anchor"
    preset="glass"
    theme="auto"
    widget-id="nuxt-docs"
    @question="onQuestion"
  />
</template>

<script setup lang="ts">
import type { Context7WidgetQuestionEventDetail } from '@desource/context7-widget-vue';

function onQuestion(detail: Context7WidgetQuestionEventDetail) {
  console.log(detail.library, detail.question);
}
</script>

Control open state

<script setup lang="ts">
const open = ref(false);
</script>

<template>
  <button type="button" @click="open = true">Ask documentation</button>
  <Context7Widget v-model:open="open" position="center" />
</template>

Use the composable

useContext7Widget can control a rendered widget by widgetId or mount a native Vue widget programmatically after the owner component mounts.

<script setup lang="ts">
const docs = useContext7Widget({ widgetId: 'docs' });

async function ask() {
  docs.open();
  await docs.send('How do I configure this module?');
}
</script>

<template>
  <button type="button" @click="ask">Ask</button>
  <Context7Widget widget-id="docs" />
</template>

For programmatic mounting:

<script setup lang="ts">
const docs = useContext7Widget({
  autoMount: true,
  library: '/owner/repo',
  preset: 'terminal',
  widgetId: 'programmatic-docs'
});
</script>

<template>
  <button type="button" @click="docs.toggle">Toggle documentation chat</button>
</template>

Use a custom trigger

<template>
  <Context7Widget custom-trigger launcher-label="Ask docs">
    <template #trigger="{ label }">
      <span>{{ label }}</span>
    </template>
  </Context7Widget>
</template>

External selector, Vue ref, and direct Element triggers work as described by the Vue package.

Module options

export default defineNuxtConfig({
  modules: ['@desource/context7-widget-nuxt'],
  context7Widget: {
    component: true,
    componentName: 'Context7Widget',
    composable: true,
    css: true,
    defaults: {
      library: '/owner/repo',
      preset: 'default',
      theme: 'auto'
    }
  }
});

| Option | Default | Purpose | | --------------- | ---------------- | ----------------------------------------------------------- | | component | true | Auto-register the native Vue component | | componentName | Context7Widget | Change the auto-imported component name | | composable | true | Auto-import useContext7Widget | | css | true | Add @desource/context7-widget-vue/styles.css globally | | defaults | {} | Provide app-wide widget props to components and composables |

defaults accepts serializable widget props. Instance props take precedence. Controlled open state and DOM-backed customTrigger values belong on a component instance, so the module type excludes them.

Disable unused integrations when an application imports them another way:

export default defineNuxtConfig({
  modules: ['@desource/context7-widget-nuxt'],
  context7Widget: {
    component: false,
    composable: false,
    css: false
  }
});

The component and composable are registered as Nuxt auto-imports. Nuxt only includes them in an application chunk when used.

Customization

Module defaults set the common theme, placement, dimensions, labels, and library:

export default defineNuxtConfig({
  modules: ['@desource/context7-widget-nuxt'],
  context7Widget: {
    defaults: {
      color: '#7cffb2',
      labels: {
        send: 'Ask'
      },
      panelHeight: 'min(42rem, 80vh)',
      panelWidth: 'min(28rem, calc(100vw - 2rem))',
      position: 'bottom-right',
      preset: 'glass',
      title: 'Project documentation'
    }
  }
});

Override CSS variables and public parts from application CSS:

.context7-widget[widget-id='docs'] {
  --c7-accent: #7cffb2;
  --c7-panel-background: #101513;
  --c7-panel-color: #f7f2e8;
  --c7-panel-radius: 8px;
}

.context7-widget [part~='send-button'] {
  min-width: 5rem;
}

Set css: false if the application imports @desource/context7-widget-vue/styles.css itself.

TypeScript

Module options are typed through Nuxt's context7Widget config key. Import component, event, option, controller, and composable types from @desource/context7-widget-vue:

import type {
  Context7WidgetController,
  Context7WidgetProps,
  Context7WidgetQuestionEventDetail,
  UseContext7WidgetReturn
} from '@desource/context7-widget-vue';

The module does not duplicate the Vue package's type export list as global auto-imports. New Vue types remain available without Nuxt module changes.

SSR behavior

The native Vue component is SSR-safe and does not need ClientOnly. Browser-only behavior starts after mount. useContext7Widget can be created during setup on the server; its imperative mount() method requires a browser document.

Data flow and privacy

The browser posts the configured library id and current conversation directly to https://context7.com/api/v2/widget/chat. The module adds no proxy, analytics, cookies, or persistent storage. Event handlers in the host application can expose question and answer data to any logging or analytics system they call.

Related packages