@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.
How to add a Mention Button to your website
- Create a new anchor element with a
twitter-mention-buttonclass to allow the X for Websites JavaScript to discover the element and enhance the link into a Mention button. Set ahrefattribute value ofhttps://x.com/intent/tweetto create a link to the X web intent composer.
- Add the username of the mentioned account as a
screen_namequery parameter value and a component of the anchor element’s inner text.
- Asynchronously load X for Websites using our loading snippet. 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 thetwttr.widgets.createMentionButton function. Pass a username, target container element, and the same options supported by the Post button JavaScript factory function.