Icon

Add Font Awesome icons inline in prose, cards, and steps.

Use <Icon> to render Font Awesome icons in your documentation pages. Pass the icon slug as name without the fa- prefix, for example user for a person icon or github for the GitHub brand mark.

Icons inherit the parent font size by default. Set size to control the pixel size, or pass standard <i> attributes such as className and style for color and layout.

mdx
<Icon name="user" size={40} style={{ color: 'red' }} />

Basic example

mdx
<Icon name="user" size={40} style={{ color: 'red' }} />

Finding icon names

Browse the Font Awesome icon library and copy the icon slug from the icon page. Use the slug without the fa- prefix.

On Font AwesomeIn your page
fa-username="user"
fa-bookname="book"
fa-githubname="github"

Inline in prose

Place <Icon> inside a sentence for emphasis or visual cues. Omit size to match surrounding text. Pass aria-hidden when the icon is decorative and nearby text conveys the meaning.

Add a

to your favorites, or open

from the sidebar.

mdx
Add a <Icon name="star" className="text-amber-500" aria-hidden /> to your favorites, or open <Icon name="folder-open" aria-hidden /> from the sidebar.

Size and color

Set size in pixels. Pass style or className for color and spacing.

Small confirmation

Medium confirmation

Large confirmation

mdx
<Icon name="circle-check" size={16} className="text-green-600" />
<Icon name="circle-check" size={24} className="text-green-600" />
<Icon name="circle-check" size={32} className="text-green-600" />

Brand icons

Brand icons (GitHub, npm, Docker, and similar) use the fa-brands style automatically. Pass the brand slug as name; docs.page detects brands from the bundled icon set.

GitHub

Source control and CI workflows.

npm

Package installation and publishing.

Docker

Container images and local development.

mdx
<Icon name="github" size={20} />
<Icon name="npm" size={20} />
<Icon name="docker" size={20} />

In cards

The <Card> component accepts an icon property that renders a header icon using the same slug format. See Card for layout options.

API reference

Browse endpoints, request bodies, and response schemas.

mdx
<Card title="API reference" icon="code">
  Browse endpoints, request bodies, and response schemas.
</Card>

In steps

Use the icon property on <Step> to replace the default step number with a custom icon. Useful when a procedure step has a clear visual association.

  • Install dependencies

    Run the install command for your package manager:

    bash
    npm install
  • Configure the project

    Add your API key to the environment file.

  • Deploy

    Push to your default branch to publish.

mdx
<Steps>
  <Step title="Install dependencies" icon="download">
    Run the install command for your package manager.
  </Step>
  <Step title="Configure the project" icon="gear">
    Add your API key to the environment file.
  </Step>
  <Step title="Deploy" icon="rocket">
    Push to your default branch to publish.
  </Step>
</Steps>

Properties

namestringrequired

The Font Awesome icon slug. Pass the name from fontawesome.com/icons without the fa- prefix, for example user, book, or github.

Brand slugs such as github and npm automatically use the brands style (fa-brands). All other slugs use the solid style (fa-solid).


sizenumberoptional

The icon size in pixels. When omitted, the icon inherits the parent element's font size.

mdx
<Icon name="star" size={24} />

Additional attributes

<Icon> renders a native <i> element. Any attribute not consumed by name or size is forwarded to that element (className, style, aria-hidden, title, and others).

The component always applies fa-fw for consistent width, plus either fa-brands or fa-solid and fa-{name} based on the slug.

mdx
<Icon
  name="triangle-exclamation"
  className="text-amber-500 mr-1"
  aria-hidden
/>

Behavior

ConditionResult
name matches a brand slug in the icon setRenders with fa-brands fa-{name}
name is any other valid slugRenders with fa-solid fa-{name}
size omittedIcon uses the parent font size
size setfont-size is set to {size}px on the <i> element
style passedMerged with the component's inline styles; your values override on conflict

See also