Add a feedback button to a Mintlify docs site
Add one script and one stylesheet to your content folder to place a floating feedback button on every page.
Free for one project and 100 votes. Paid plans start with a 14 day trial, no card.
How Mintlify loads code
The content folder is the one that holds docs.json. Mintlify includes each script file in it after the page becomes interactive, and you cannot limit one to a single page.
Any .js file in the content folder runs on every page.
Several files run with no guaranteed order.
Mintlify asks you to load a third party script by creating the element from your own JavaScript file, and not by writing a raw script tag into a page. That is the pattern used here, with the data attributes VoteFirst reads set on the new element.
A custom file also runs once per visit. When a reader moves from page to page, Mintlify swaps the content without a reload. So the script is not run again, and anything it adds to the document body stays in place.
The script file
The file loads the VoteFirst script, and when it has loaded it adds a button and hands that button to VoteFirst.suggest.
Create votefirst.js next to docs.json.
Your slug and key come from Share and Embed.
VoteFirst reads its slug and key from the data attributes of the script that is running, and a script added with createElement counts as that script while it runs. The onload handler fires after the file has run, so window.VoteFirst exists when the button is bound.
The key is meant to be public. All it does is let listed origins open the form and send votes, so a file in your repository can hold it.
const script = document.createElement('script');
script.src = 'https://app.votefirst.app/embed/votefirst.js';
script.async = true;
script.dataset.project = 'your-slug';
script.dataset.key = 'your-key';
script.onload = () => {
const button = document.createElement('button');
button.type = 'button';
button.className = 'feedback-button';
button.textContent = 'Feedback';
document.body.appendChild(button);
window.VoteFirst.suggest({ trigger: button });
};
document.head.appendChild(script);The stylesheet
Mintlify includes any .css file from the content folder on every page too. A short rule keeps the button in the corner while readers scroll.
Pin the button with a CSS file in the same folder.
Color it from your own theme.
Mintlify warns that its own element names and hooks may change, so the rule targets only a class you chose and nothing that belongs to the theme. A change to the theme cannot break it.
Check the button in dark mode as well as light. If your theme has both, add a second rule for dark mode, since the colors above assume a light page.
.feedback-button {
position: fixed;
right: 16px;
bottom: 16px;
z-index: 40;
padding: 8px 16px;
border-radius: 9999px;
border: 1px solid #d4d4d8;
background: #ffffff;
color: #18181b;
cursor: pointer;
}The board
The popup takes an idea. The board shows every idea with its status and its votes, and a reader can vote with no account.
Link a public board so readers can vote.
A suggestion stays hidden until you approve it.
Add the board address to your navigation or to a card on your welcome page. Developers who read docs often know exactly what is missing, and a vote costs them one click.
When two cards say the same thing you can merge them, and the votes of both land on the card you keep. A person who voted on each is counted once. The board can also answer at your own subdomain, a feature of the Free and Pro plans.
If it fails
If no button appears, confirm that votefirst.js sits in the same folder as docs.json and open the browser console for errors.
Check the folder, then the origins.
The console names a refused origin as origin_not_allowed.
A file in a subfolder of the content folder is also included, but the safest place is the top, beside docs.json. If the form reports an error, compare the slug and the key with the values on Share and Embed.
List your live docs address on Share and Embed. A preview deployment on another address is a separate origin, so add it while you test and take it off again once the change is live.
Make the change in a preview first if your docs host offers one, and open a page in a private window to see what a first time reader sees. A cached copy can hide a fix for a few minutes, so reload without the cache before you decide it did not work. Then check that the board address in the script is the public one.
What a docs site gains
One place to ask
A button in the corner of every page works wherever a reader runs into a gap.
No theme edits
Two small files in your repository replace any change to the Mintlify theme.
Counted requests
Repeats become votes on one card, so the top of the list shows what developers want.
Add it in five steps
Two files and one link do the whole job.
Get the slug and key
Start a Free project and find both under Share and Embed.
Create votefirst.js
Add the script file next to docs.json with your slug and key.
Create style.css
Add the rule that pins the button to the corner.
Link the board
Put the board address in your navigation or on a welcome card.
List your origins
Add your docs address and any preview address to the key.
Checking after a docs deploy
After each deploy, open a docs page in a private window and look for the button in its corner. Because Mintlify runs the script on every page, check one page from each section, in both the dark and light themes.
If the button is missing, confirm that the files sit in the content folder next to the configuration file, then check that your docs address is on the list of allowed origins.
What to know before you set this up
- Mintlify can change how it includes custom files, so check its custom scripts page for your plan.
- The script cannot be limited to one page, since Mintlify runs it on all of them.
- The form opens only from listed origins, so a preview address must be added.
- On Free the board stops at 100 votes, and a vote someone takes back still counts against that limit.
What docs maintainers ask
Why a script file and not a script tag in an MDX page?
Mintlify tells you to load a third party script by creating the element from your own JavaScript file. A raw tag in a page is not the supported route.
Does the button survive moving between pages?
Yes. The file runs once per visit and the button sits in the body, outside the content that Mintlify swaps between pages.
Can the button show on only some pages?
Not with this file. Mintlify runs custom scripts on every page and offers no way to scope one to a single page.
Is there a package or a Mintlify integration?
No. VoteFirst is one hosted file, so the repository gains two small files and no dependency.
Does the key have to stay private?
No. Anyone who views the page can read it, and it grants nothing beyond opening the form and sending votes from listed origins.
Do readers need an account to vote?
No. A new board accepts votes from visitors with no login. Turn on required sign in when each vote has to belong to a named person.
Does the popup need destroy here?
It lifts the click listener off the button. Here the button lives for the whole visit, so nothing needs releasing.
Can the board sit on a subdomain of my docs domain?
Yes, on the Free and Pro plans. Point a name such as feedback.yoursite.com at the board.
Where do new suggestions show up?
In the dashboard, each as a card that waits for your approval. The owner is emailed at most once a day about new ones.
What does it cost to start?
The Free plan has one project and 100 votes. Lite costs $9/mo and Pro costs $39/mo, with a 14 day trial of either and no card needed.
More ways to add a board
More on docs sites, the popup and the public roadmap.
A button on Docusaurus
The same job for a React docs site.
A button for any website
Every option the popup takes.
Make a public roadmap
Show readers what comes next.
Add a feedback button to an Astro site
An inline tag in the layout and a page load listener.
Add a feedback button to a SvelteKit app
The popup binds in onMount, after server render.
Let developers flag what docs lack
The Free plan keeps one project and 100 votes at no cost, and a 14 day trial of Lite or Pro asks for no card.