New Topic Header Button

:discourse2: Summary New Topic Header Button adds a convenient ‘New Topic’ button to the header of all pages
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component


A simple theme component to add the + New Topic button to the header. The button will show on every page - even inside topics.





Name Description
new topic button icon Choose an icon for the button. You can use any free FontAwesome 5 icon name like music or star .
new topic button text Enter the text you want the button to use. You can also leave this empty if you want to only use an icon.
new topic button title Enter the title you want the button to use. If this is left empy, the title will be the same as the button text
hide default button Hide the default “New topic” button in topic lists
show to anon Show the button to logged-out visitors, and have it redirect to login on click

:discourse2: Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.

Last edited by @JammyDodger 2024-06-13T13:13:59Z

Check documentPerform check on document:

Pretty awesome. Now we’re talking!

FYI, we pushed the button yesterday and it was our 2nd biggest day in registrations for the past 30 days. Not sure if it was coincidence or not, but I have a feeling it’s a good way to onboard new users. Will keep an eye on the metrics

(Realizing now it must have been a coincidence, because the button only appears for users who have already logged in. Nonetheless, activity does seem to be higher)



Is it possible to change the color of the button, but not change the color of all buttons in the site?

If so, which is the css code for the button only?


1 Like

Use this code, changing the color obviously.

#new-create-topic {
    background-color: red;

Hm, how about showing the new topic button for everyone and make it act like the default Reply-to-topic button, i.e. as the user to login/sign up if they’re not logged in?

In fact, this might be something to consider for the default new topic button too, but I guess this feature would be most effective in this theme component…


Inviting every random visitor to create a new topic… will end in tears :sob:

Nothing kills a site quicker than a page full of low-value or gibberish topics.


Well, they can’t create that topic unless they sign up. And encouraging people to sign up is obviously a good thing (and is being done by default via the sign-up button and the reply-to-topic button). So I don’t really see why the new topic button should cause any problems.


Is it possible to hide the button on mobile but show the floating button?

To hide the button on mobile add

.header-buttons #new-create-topic {

in your mobile > CSS tab

The floating button you are referring is the one used on the Material Design Stock Theme component? If so you need to copy and paste the part of CSS relative to the floating button (New Topic Fab) from material-design-stock-theme/desktop/desktop.scss at main · discourse/material-design-stock-theme · GitHub to your mobile > CSS tab (deleting the lines that start with @include [...]).

However your requests are going off topic, it’s better if you open another topic.


Thanks, sorry for the offtopicing :slight_smile:

1 Like

This is good, but it has two drawbacks from my point of view.
First is the location of the button in the top bar. We already have other stuff added to the top bar and this makes it a bit crowded.
Second is the fact it appears on every page, even where it is a bit illogical (eg on my profile page, or the groups list).
The primary use case from my point of view is to make it slightly easier for users not to make off-topic replies when viewing a thread. The place I find it is really needed and useful is when viewing a topic/thread and ideally I would like it to appear both at the top (in line with the topic title) and at the bottom next to the main blue Reply button.
A halfway house would be to show it in the current position but only on /t/xxx pages.
Is this possible?

I don’t want to display it on mobile, how do I do it?

I also want to show it to the unregistered user, clicking the button will ask you to login

Oh. Bummer. I don’t know what “wrong position” means (it seems OK on my test site), but did assume that the button would work, which I see now that it doesn’t. It looks like it’s not as simple as I thought. :frowning_face:

1 Like

Create a new theme component and add this in the Mobile > CSS tab

.mobile-view #new-create-topic {

good idea - you did it ?

Can someone help me know what CSS to target to get this + New Topic button to look/function exactly as the colorful “Reply” button on my site? (i.e. the standard state, as well as the hover and clicked-on state - active?)

Here’s a visual explanation of what I’d like to do…

change its class to btn-primary ?
(not sure if you can have two btn-primary items on a page)
If you want to have a pure css solution then inspect the styling of the blue primary button (in all its states) and replicate that.

Thanks for this component @Joe.
It works perfectly with a small exception :slight_smile:
On mobile I still have two buttons: new one and default one+ New Topic buttons.


I made the default one disappear by changing the following style definition:
Now it works fine on desktops and on mobiles, but it would be nice if your component would take care about this. Especially that if from some reason some admin will turn off your component, any + New Topic button won’t be visible.


@Johani I made a pull request with change mentioned above.
Could you please look at it?


Thank you for the component! I think there can be good use cases to always have the option to create a new topic be present in the header. But I’m struggling with one detail of implementing it and wonder how others approach this:

Right now, the component reflects the category the user is on and will open the composer with this category pre-filled. But it doesn’t reflect whether the user has write access to that particular category. So it will pre-fill the composer with that category (although the user couldn’t otherwise select that category manually) and result in an error when trying to save the topic.

The default New-topic-button addresses this by being disabled on such categories. But I think it wouldn’t be so intuitive either to copy this behavior, because the idea with the button in the header is to have a global access to create new topics. And then it would be weird if it’s sometimes not functional.

What could be a good general approach for this? Or how do others that use the component approach it? Just drop the pre-filling alltogether?