Skip to content

Commit 1aaae5f

Browse files
dino475ethanpalm
andauthored
Update accordions.mdx (#971)
* Update accordions.mdx * add snippet for icons * use icon snippet for consistency * add required/optional icon snippets * update for required/optional --------- Co-authored-by: Ethan Palm <[email protected]>
1 parent dfb51cb commit 1aaae5f

File tree

10 files changed

+72
-57
lines changed

10 files changed

+72
-57
lines changed

ai/contextual-menu.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ icon: "square-menu"
55
---
66

77
import { PreviewButton } from "/snippets/previewbutton.jsx"
8+
import IconsRequired from "/snippets/icons-required.mdx";
89

910
The contextual menu provides quick access to AI-optimized content and direct integrations with popular AI tools. When users select the contextual menu on any page, they can copy content as context for AI tools or open conversations in ChatGPT, Claude, Perplexity, or a custom tool of your choice with your documentation already loaded as context.
1011

@@ -63,9 +64,7 @@ Create custom options in the contextual menu by adding an object to the `options
6364
The description of the option. Displayed beneath the title when the contextual menu is expanded.
6465
</ResponseField>
6566

66-
<ResponseField name="icon" type="string" required>
67-
The icon of the option. Accepts any icon from the [Icons](/components/icons) collection.
68-
</ResponseField>
67+
<IconsRequired />
6968

7069
<ResponseField name="href" type="string | object" required>
7170
The href of the option. Use a string for simple links or an object for dynamic links with query parameters.

code.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const hello = "world";
9393

9494
### Icon
9595

96-
Add an icon to your code block. You can use [FontAwesome](https://fontawesome.com/icons) icons, [Lucide](https://lucide.dev/icons/) icons, or absolute URLs.
96+
Add an icon to your code block using the `icon` property. See [Icons](/components/icons) for all available options.
9797

9898
```javascript icon="square-js"
9999
const hello = "world";

components/accordions.mdx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: "Collapsible components to show and hide content"
44
icon: "chevron-down"
55
---
66

7+
import IconsOptional from "/snippets/icons-optional.mdx";
8+
79
Accordions allow users to expand and collapse content sections. Use accordions for progressive disclosure and to organize information.
810

911
## Single accordion
@@ -97,11 +99,4 @@ Group related accordions together using `<AccordionGroup>`. This creates a cohes
9799
Whether the Accordion is open by default.
98100
</ResponseField>
99101

100-
<ResponseField name="icon" type="string or svg">
101-
A [Font Awesome icon](https://fontawesome.com/icons), [Lucide
102-
icon](https://lucide.dev/icons), or SVG code.
103-
</ResponseField>
104-
105-
<ResponseField name="iconType" type="string">
106-
For Font Awesome icons, one of "regular", "solid", "light", "thin", "sharp-solid", "duotone", or "brands".
107-
</ResponseField>
102+
<IconsOptional />

components/cards.mdx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: "Highlight main points or links with customizable layouts and icons
44
icon: "square-mouse-pointer"
55
---
66

7+
import IconsOptional from "/snippets/icons-optional.mdx";
8+
79
Use cards to create visual containers for content. Cards are flexible containers that can include text, icons, images, and links.
810

911
## Basic card
@@ -102,19 +104,7 @@ Use the [Columns component](/components/columns) to organize multiple cards side
102104
The title displayed on the card
103105
</ResponseField>
104106

105-
<ResponseField name="icon" type="string or svg">
106-
Icon to display on the card. Use a [Font Awesome icon](https://fontawesome.com/icons) name, [Lucide icon](https://lucide.dev/icons) name, or JSX-compatible SVG code wrapped in `icon={}`.
107-
108-
For custom SVG icons:
109-
1. Use the [SVGR converter](https://react-svgr.com/playground/).
110-
2. Copy the code inside the `<svg/>` tag.
111-
3. Paste the code into your card.
112-
4. Adjust height and width as needed.
113-
</ResponseField>
114-
115-
<ResponseField name="iconType" type="string">
116-
Font Awesome icon style: `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, or `brands`.
117-
</ResponseField>
107+
<IconsOptional />
118108

119109
<ResponseField name="color" type="string">
120110
Icon color as a hex code (e.g., `#FF6B6B`).

components/icons.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ description: "Use icons from popular icon libraries"
44
icon: "flag"
55
---
66

7-
Use icons from Font Awesome, Lucide, URLs, or files in your project to enhance your documentation.
7+
import IconsRequired from "/snippets/icons-required.mdx";
8+
9+
Use icons from Font Awesome, Lucide, SVGs, external URLs, or files in your project to enhance your documentation.
810

911
<Icon icon="flag" size={32} />
1012

@@ -24,13 +26,7 @@ Icons are placed inline when used within a paragraph.
2426

2527
## Properties
2628

27-
<ResponseField name="icon" type="string" required>
28-
A [Font Awesome](https://fontawesome.com/icons) icon, [Lucide](https://lucide.dev/icons) icon, URL to an icon, or relative path to an icon.
29-
</ResponseField>
30-
31-
<ResponseField name="iconType" type="string">
32-
For [Font Awesome](https://fontawesome.com/icons) icons only: One of `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands`.
33-
</ResponseField>
29+
<IconsRequired />
3430

3531
<ResponseField name="color" type="string">
3632
The color of the icon as a hex code (for example, `#FF5733`).

components/steps.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: "Sequence content using the Steps component"
44
icon: "list-todo"
55
---
66

7+
import IconsOptional from "/snippets/icons-optional.mdx";
8+
79
Use steps to display a series of sequential actions or events. You can add as many steps as needed.
810

911
<Steps>
@@ -48,13 +50,7 @@ Use steps to display a series of sequential actions or events. You can add as ma
4850
The content of a step either as plain text or components.
4951
</ResponseField>
5052

51-
<ResponseField name="icon" type="string or svg">
52-
A [Font Awesome icon](https://fontawesome.com/icons), [Lucide icon](https://lucide.dev/icons), or SVG code in `icon={}`.
53-
</ResponseField>
54-
55-
<ResponseField name="iconType" type="string">
56-
For Font Awesome icons only: One of `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands`.
57-
</ResponseField>
53+
<IconsOptional />
5854

5955
<ResponseField name="title" type="string">
6056
The title is the primary text for the step and shows up next to the indicator.

pages.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ icon: "letter-text"
55
keywords: ["tags", "tag"]
66
---
77

8+
import IconsOptional from "/snippets/icons-optional.mdx";
9+
810
Each page is an MDX file, which combines Markdown content with React components to let you create rich, interactive documentation.
911

1012
## Page metadata
@@ -28,10 +30,7 @@ Use metadata to control:
2830
A short title that displays in the sidebar navigation.
2931
</ResponseField>
3032

31-
<ResponseField name="icon" type="string">
32-
An icon next to your page title in the sidebar. Choose an icon from Font Awesome, Lucide, or use a custom URL. Configure your preferred icon library with the [icons library setting](/settings#param-icons).
33-
34-
</ResponseField>
33+
<IconsOptional />
3534

3635
<ResponseField name="tag" type="string">
3736
A tag that appears next to your page title in the sidebar.

settings.mdx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ icon: "settings-2"
55
keywords: ["docs.json", "settings", "customization", "configuration"]
66
---
77

8+
import IconsOptional from "/snippets/icons-optional.mdx";
9+
810
The `docs.json` file lets you turn a collection of Markdown files into a navigable, customized documentation site. This required configuration file controls styling, navigation, integrations, and more.
911

1012
Settings in `docs.json` apply globally to all pages.
@@ -146,7 +148,7 @@ See [Themes](themes) for more information.
146148
Icon library to use throughout your documentation. Defaults to `fontawesome`.
147149

148150
<Note>
149-
You can specify a URL for any individual icon, regardless of the library setting.
151+
You can specify a URL to an externally hosted icon, path to an icon file in your project, or JSX-compatible SVG code for any individual icon, regardless of the library setting.
150152
</Note>
151153
</ResponseField>
152154

@@ -277,9 +279,7 @@ See [Themes](themes) for more information.
277279
<ResponseField name="href" type="string (uri)" required>
278280
URL or path for the link destination.
279281
</ResponseField>
280-
<ResponseField name="icon" type="string | object">
281-
Icon for the link. Can be a URL (relative or external), Font Awesome icon, or Lucide icon.
282-
</ResponseField>
282+
<IconsOptional />
283283
</Expandable>
284284
</ResponseField>
285285
<ResponseField name="primary" type="object">
@@ -356,9 +356,7 @@ See [Themes](themes) for more information.
356356

357357
Minimum length: 1
358358
</ResponseField>
359-
<ResponseField name="icon" type="string or object">
360-
Icon for the tab. Can be a URL (relative or external), Font Awesome icon, or Lucide icon.
361-
</ResponseField>
359+
<IconsOptional />
362360
<ResponseField name="hidden" type="boolean">
363361
Whether to hide this tab by default.
364362
</ResponseField>
@@ -376,9 +374,7 @@ See [Themes](themes) for more information.
376374

377375
Minimum length: 1
378376
</ResponseField>
379-
<ResponseField name="icon" type="string or object">
380-
Icon for the anchor. Can be a URL (relative or external), Font Awesome icon, or Lucide icon.
381-
</ResponseField>
377+
<IconsOptional />
382378
<ResponseField name="color" type="object">
383379
Custom colors for the anchor.
384380

@@ -413,9 +409,7 @@ See [Themes](themes) for more information.
413409

414410
Minimum length: 1
415411
</ResponseField>
416-
<ResponseField name="icon" type="string or object">
417-
Icon for the dropdown. Can be a URL (relative or external), Font Awesome icon, or Lucide icon.
418-
</ResponseField>
412+
<IconsOptional />
419413
<ResponseField name="hidden" type="boolean">
420414
Whether to hide this dropdown by default.
421415
</ResponseField>

snippets/icons-optional.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<ResponseField name="icon" type="string">
2+
The icon to display.
3+
4+
Options:
5+
- [Font Awesome icon](https://fontawesome.com/icons) name
6+
- [Lucide icon](https://lucide.dev/icons) name
7+
- JSX-compatible SVG code wrapped in curly braces
8+
- URL to an externally hosted icon
9+
- Path to an icon file in your project
10+
11+
For custom SVG icons:
12+
1. Convert your SVG using the [SVGR converter](https://react-svgr.com/playground/).
13+
1. Paste your SVG code into the SVG input field.
14+
2. Copy the complete `<svg>...</svg>` element from the JSX output field.
15+
3. Wrap the JSX-compatible SVG code in curly braces: `icon={<svg ...> ... </svg>}`.
16+
4. Adjust `height` and `width` as needed.
17+
</ResponseField>
18+
19+
<ResponseField name="iconType" type="string">
20+
The [Font Awesome](https://fontawesome.com/icons) icon style. Only used with Font Awesome icons.
21+
22+
Options: `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands`.
23+
</ResponseField>

snippets/icons-required.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<ResponseField name="icon" type="string" required>
2+
The icon to display.
3+
4+
Options:
5+
- [Font Awesome icon](https://fontawesome.com/icons) name
6+
- [Lucide icon](https://lucide.dev/icons) name
7+
- JSX-compatible SVG code wrapped in curly braces
8+
- URL to an externally hosted icon
9+
- Path to an icon file in your project
10+
11+
For custom SVG icons:
12+
1. Convert your SVG using the [SVGR converter](https://react-svgr.com/playground/).
13+
1. Paste your SVG code into the SVG input field.
14+
2. Copy the complete `<svg>...</svg>` element from the JSX output field.
15+
3. Wrap the JSX-compatible SVG code in curly braces: `icon={<svg ...> ... </svg>}`.
16+
4. Adjust `height` and `width` as needed.
17+
</ResponseField>
18+
19+
<ResponseField name="iconType" type="string">
20+
The [Font Awesome](https://fontawesome.com/icons) icon style. Only used with Font Awesome icons.
21+
22+
Options: `regular`, `solid`, `light`, `thin`, `sharp-solid`, `duotone`, `brands`.
23+
</ResponseField>

0 commit comments

Comments
 (0)