feat(theme): add versions attribute to docsVersionDropdown navbar item (#10852)

Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
Oleksiy Gapotchenko 2025-01-30 18:21:54 +01:00 committed by GitHub
parent 8bc3e8a092
commit 4d7a28963a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 276 additions and 10 deletions

View file

@ -597,11 +597,23 @@ Accepted fields:
| `dropdownItemsAfter` | <code>[LinkLikeItem](#navbar-dropdown)[]</code> | `[]` | Add additional dropdown items at the end of the dropdown. |
| `docsPluginId` | `string` | `'default'` | The ID of the docs plugin that the doc versioning belongs to. |
| `dropdownActiveClassDisabled` | `boolean` | `false` | Do not add the link active class when browsing docs. |
| `versions` | `DropdownVersions` | `undefined` | Specify a custom list of versions to include in the dropdown. See [the versioning guide](../../guides/docs/versioning.mdx#docsVersionDropdown) for details. |
```mdx-code-block
</APITable>
```
Types:
```ts
type DropdownVersion = {
/** Allows you to provide a custom display label for each version. */
label?: string;
};
type DropdownVersions = string[] | {[versionName: string]: DropdownVersion};
```
Example configuration:
```js title="docusaurus.config.js"