# Reusable snippets
Reuse MDX fragments and compact copyable values across Plandalf docs with Mintlify-style authoring patterns.
Source: /docs/components/reusable-snippets
Last modified: 2026-06-20
import OfferTermSnippet, { offerSnippetDefaults } from "../../../src/components/docs/snippets/OfferTermSnippet.mdx";

Reusable snippets keep repeated definitions, warnings, and setup fragments consistent. Use the inline `Snippet` component for one literal value, and use imported MDX fragments when the same explanation appears on multiple pages.

## Inline value

Set `PLANDALF_PUBLIC_KEY` in the browser environment and keep `PLANDALF_API_KEY` on the server.

```mdx title="inline-snippet.mdx"
Set `PLANDALF_PUBLIC_KEY` in the browser environment and keep `PLANDALF_API_KEY` on the server.
```

## Imported MDX fragment


> **Offer term snippet**
>

  <OfferTermSnippet term="offer" href={offerSnippetDefaults.href} />


```mdx title="content/docs/example-page.mdx"
import OfferTermSnippet, { offerSnippetDefaults } from "../../../src/components/docs/snippets/OfferTermSnippet.mdx";

<OfferTermSnippet term="offer" href={offerSnippetDefaults.href} />
```

## Fragment file

Store reusable MDX fragments outside `content/docs` so they do not become public docs routes.


- src/components/docs/


- snippets/


- OfferTermSnippet.mdx


- content/docs/


- quickstart.mdx


```mdx title="src/components/docs/snippets/OfferTermSnippet.mdx"
import Tooltip from '../v2/Tooltip.astro';
import Snippet from '../v2/Snippet.astro';

export const offerSnippetDefaults = {
  term: 'offer',
  href: '/docs/offers/overview',
};

export default function OfferTermSnippet({ term = offerSnippetDefaults.term, href = offerSnippetDefaults.href }) {
  return (
    <span>
      A Plandalf {term} is the root object behind checkout. Use `offer_founder_launch` as the reusable example slug.
    </span>
  );
}
```

## Authoring rules


### Reusable snippet rules


- `Use Snippet for one value` (inline):
    Use the component for API keys, package names, IDs, headers, paths, and command fragments.


- `Use imported MDX for repeated prose` (fragment):
    Import a fragment for reusable definitions, warnings, setup steps, or product explanations.


- `Keep fragments outside content/docs` (route safety):
    Files under `content/docs` become public pages. Put reusable fragments under `src/components/docs/snippets`.


- `Pass variables as props` (customizable):
    Make repeated snippets adaptable with props such as `term`, `href`, or `label`.


## Properties


- `Snippet.text` (string):
  Literal snippet value shown and copied.


- `Snippet.label` (string):
  Alias for `text` when imported MDX uses label-style props.


- `Snippet.icon` (string; default: copy):
  Icon rendered before the value.


- `Snippet.copy` (boolean; default: true):
  Shows or hides the copy affordance.


## Related


  - [Snippet](/docs/components/snippet): See the compact inline component.
  - [Tooltips](/docs/components/tooltips): Reuse definitions with inline help.
  - [Files](/docs/components/files): Document downloadable files and paths.