# Fumadocs Core (the core library of Fumadocs): Package Install
URL: /docs/headless/mdx/install
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/headless/mdx/install.mdx

Generate code blocks for installing packages

<Callout type="warn" title="Deprecated">
Use [Remark NPM](/docs/headless/mdx/remark-npm) instead. It is a drop-in replacement, enabled by default in Fumadocs MDX.
</Callout>

## Usage [#usage]

```package-install
fumadocs-docgen
```

`remarkInstall` is a remark plugin with no Sätteri version. Add it, and disable Remark NPM which handles `package-install` code blocks first:

```ts title="source.config.ts"
import { remarkInstall } from 'fumadocs-docgen';
import { defineConfig } from 'fumadocs-mdx/config';

export default defineConfig({
  mdxOptions: {
    remarkNpmOptions: false,
    remarkPlugins: [remarkInstall],
  },
});
```

Define the required components.

```tsx title="components/mdx.tsx"
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
import defaultComponents from 'fumadocs-ui/mdx';
import type { MDXComponents } from 'mdx/types';

export function getMDXComponents(components?: MDXComponents) {
  return {
    ...defaultComponents,
    // [!code ++:2]
    Tab,
    Tabs,
    ...components,
  } satisfies MDXComponents;
}
```

Create code blocks with `package-install` as language.

````mdx
```package-install
my-package
```

```package-install
npm i my-package -D
```
````

### Output [#output]

```mdx
<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
  <Tab value="npm">...</Tab>
  <Tab value="pnpm">...</Tab>
  <Tab value="yarn">...</Tab>
  <Tab value="bun">...</Tab>
</Tabs>
```

## Options [#options]

### Persistent [#persistent]

When using with Fumadocs UI, you can enable persistence with the `persist` option.

```ts title="source.config.ts"
import { remarkInstall } from 'fumadocs-docgen';
import { defineConfig } from 'fumadocs-mdx/config';

export default defineConfig({
  mdxOptions: {
    remarkNpmOptions: false,
    remarkPlugins: [[remarkInstall, { persist: { id: 'some-id' } }]],
  },
});
```

This will instead generate:

```mdx
<Tabs groupId="some-id" persist items={[...]}>
  ...
</Tabs>
```