---
title: "ComponentProps"
description: "Generate a Vue props table with `:component-props`, using types, defaults, and descriptions from component metadata."
canonical_url: "https://docs.mhaibaraai.me/en/docs/components/component-props"
---
# ComponentProps

> Generate a Vue props table with \`:component-props\`, using types, defaults, and descriptions from component metadata.

`ComponentProps` reads a component's `defineProps` and renders the name, default value, type and JSDoc description of every prop as a table.

> [!NOTE]
> See: /en/docs/guide/features
> 
> Component docs are disabled by default. Before using this page and 
> 
> ComponentSlots
> 
> , 
> 
> ComponentEmits
> 
> , 
> 
> ComponentExample
> 
>  or 
> 
> ComponentCode
> 
> , set 
> 
> movkNuxtDocs.componentDocs: true
> 
>  in 
> 
> nuxt.config.ts
> 
>  and install 
> 
> nuxt-component-meta
> 
> , 
> 
> vue-component-meta
> 
>  and 
> 
> prettier
> 
> .

## Usage

Pass the component name with `slug`:

```mdc
:component-props{slug="TestApi"}
```

### Infer the component from the route

Without `slug`, the last segment of the current route is converted to PascalCase, so `/docs/components/button` maps to `Button`. When each component has its own page named after it, `:component-props` is enough.

### Ignore props

Use `ignore` to hide props from the table. By default the routing props forwarded to `NuxtLink` (`href`, `prefetch`, `replace` and so on) and form props (`form`, `formaction` and so on) are hidden; passing `ignore` replaces that default list:

```mdc
:component-props{slug="TestApi" :ignore='["disabled", "avatar"]'}
```

### Prose components

With `prose`, the `Prose` prefix is added to the name, so `:component-props{prose}` on the `mermaid` page maps to `ProseMermaid`.

## Where the data comes from

The table is built from the types and comments in the component source:

- **Default**: taken from `withDefaults` or a destructuring default; falls back to the JSDoc `@defaultValue` tag
- **Type**: enum types are expanded into unions, object types can be expanded to show nested fields
- **Description**: the JSDoc body is rendered as Markdown and tags such as `@see` become links

```vue [components/TestApi.vue]
<script setup lang="ts">
interface Props {
  /**
   * The variant of the component
   * @defaultValue 'solid'
   */
  variant?: 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost' | 'link'
}

defineProps<Props>()
</script>
```

> [!TIP]
> See: /en/docs/reference/nuxt-config
> 
> Components in your project's 
> 
> app/components/
> 
>  and 
> 
> components/
> 
>  directories get no metadata by default. Add the ones you document to 
> 
> componentMeta.include
> 
> , for example 
> 
> componentMeta: \{ include: \['app/components/TestApi.vue'\] }
> 
> . 
> 
> include
> 
>  accepts paths, globs, regular expressions and functions.

## API

### Props

```ts
/**
 * Props for the ComponentProps component
 */
interface ComponentPropsProps {
  /**
   * 获取组件属性的 slug 标识
   * @default 路由路径的最后一段
   */
  slug?: string | undefined;
  /**
   * 需要忽略的属性名数组
   * @default [
    "activeClass",
    "inactiveClass",
    "exactActiveClass",
    "ariaCurrentValue",
    "href",
    "rel",
    "noRel",
    "prefetch",
    "prefetchOn",
    "noPrefetch",
    "prefetchedClass",
    "replace",
    "exact",
    "exactQuery",
    "exactHash",
    "external",
    "onClick",
    "viewTransition",
    "enterKeyHint",
    "form",
    "formaction",
    "formenctype",
    "formmethod",
    "formnovalidate",
    "formtarget"
]
   */
  ignore?: string[] | undefined;
  prose?: boolean | undefined;
}
```

## Changelog

See commit history for [layer/modules/component-docs/runtime/components/ComponentProps.vue](https://github.com/mhaibaraai/movk-nuxt-docs/commits/main/layer/modules/component-docs/runtime/components/ComponentProps.vue).

---

- [GitHub](https://github.com/mhaibaraai/movk-nuxt-docs/blob/main/layer/modules/component-docs/runtime/components/ComponentProps.vue)


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.me/sitemap.md) for all pages.
