# Is this the correct way to create a theme component?

**URL:** https://meta.discourse.org/t/is-this-the-correct-way-to-create-a-theme-component/334468
**Category:** Development
**Created:** [November 4, 2024, 7:11pm UTC](https://meta.discourse.org/t/is-this-the-correct-way-to-create-a-theme-component/334468 "2024-11-04T19:11:40Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [November 4, 2024, 7:45pm UTC](https://meta.discourse.org/t/is-this-the-correct-way-to-create-a-theme-component/334468/2 "2024-11-04T19:45:39Z")

</div>

Although this way of doing things is technically possible, it’s not the _ideal_ approach.

Instead of using script tags and jQuery `$(document).ready` it would be better to work with Ember’s rendering system correctly.

To start, it would be good to create a theme component repository with a proper folder structure for your theme-component. Have a look at the [`discourse_theme` CLI](https://meta.discourse.org/t/install-the-discourse-theme-cli-console-app-to-help-you-build-themes/82950/1) as this will scaffold out that structure for you, and make it easy for you to develop the component. (Alternatively, there’s also the [theme skeleton](https://github.com/discourse/discourse-theme-skeleton) if you only need the structure and not any of the other goodies of the theme CLI).

From here, I would use tools Discourse has in place for extensibility such as `apiInitializers`, the [`pluginAPI`](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/plugin-api.gjs), plugin outlets, etc. to achieve what you’re trying to do.

The best way to learn about these things is to peruse the [Developer Guides here on Meta](https://meta.discourse.org/c/documentation/developer-guides/56) (specifically the theme/theme-component) sections. Additionally, I would go through the #Customization > Theme component category and find their GitHub repositories. Looking through their code and how they achieve things will help you as well.

I hope this helps!

---

_[View the full topic](https://meta.discourse.org/t/is-this-the-correct-way-to-create-a-theme-component/334468)._
