> For the complete documentation index, see [llms.txt](https://shinyobjectlabs.gitbook.io/framework-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shinyobjectlabs.gitbook.io/framework-js/components/creating-a-component.md).

# Creating a Component

To create a component call `$app.createComponent()` passing the name of the component and the data used to initialise the reactive store.

### Arguments

<table><thead><tr><th>Name</th><th>Type</th><th width="273.66666666666663">Description</th></tr></thead><tbody><tr><td>Name</td><td>string (snake_case)</td><td>The name of the component</td></tr><tr><td>Initial Data</td><td>object</td><td>Data used to initialise the reactive data store</td></tr></tbody></table>

### Example

<pre class="language-html"><code class="lang-html">&#x3C;script>
  const myComponentStore = {
    fields: {
      first_name: 'Jane',
      last_name: 'Doe',
    },
    displaySuccess: false,
    displayError: false,
  };
  
<strong>  $app.createComponent('my_component', myComponentStore).mount('#myComponent');
</strong>&#x3C;/script>
</code></pre>
