> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mention Button

> A Mention button is a special type of Post button to encourage a new Post focused on an interaction between the user and a mentioned account.

A Mention button is a special type of [Post button](/x-for-websites/post-button/overview) to encourage a new Post focused on an interaction between the user and a mentioned account. A Post beginning with `@username` do not appear on the author’s timeline in the default view; the Post will only appear in the home timeline of the author’s followers if the viewer follows both the author and the mentioned user. [Read more about @replies and @mentions](https://support.x.com/articles/14023).

## How to add a Mention Button to your website

1. Create a new anchor element with a `twitter-mention-button` class to allow the X for Websites JavaScript to discover the element and enhance the link into a Mention button. Set a `href` attribute value of `https://x.com/intent/tweet` to create a link to the X web intent composer.

```html theme={null}
<a class="twitter-mention-button"
  href="https://x.com/intent/tweet">
Post</a>
```

2. Add the username of the mentioned account as a `screen_name` query parameter value and a component of the anchor element’s inner text.

```html theme={null}
<a class="twitter-mention-button"
  href="https://x.com/intent/tweet?screen_name=XDevelopers">
Post to @XDevelopers</a>
```

3. Asynchronously [load X for Websites using our loading snippet](/x-for-websites/javascript-api/guides/set-up-x-for-websites). The JavaScript snippet will check for an existing version on the page, initialize a function queue to be executed once the widgets JavaScript has loaded, and load the widgets JavaScript asynchronously from X's CDN.

## JavaScript factory function

X's widget JavaScript library supports dynamic insertion of a Mention button using the `twttr.widgets.createMentionButton` function. Pass a username, target container element, and the same options supported by the [Post button JavaScript factory function](/x-for-websites/post-button/guides/javascript-factory-function).

```html theme={null}
twttr.widgets.createMentionButton(
  "XDevelopers",
  document.getElementById("container"),
  {
    size:"large"
  }
);
```
