---
sourceDocument: Xanadu Build or modify applications
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/application-development

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Develop a component

# Develop a component {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Add your component code and test it using a local development server.

## Before you begin

* [Set up your environment](https://servicenow-prod.fluidtopics.net/7fwEmY7ytgAe_M1H8nFU8Q "Prepare your local environment by installing the Node.js JavaScript runtime environment, Node package manager (npm), and the ui-component extension. These tools enable you to develop and build components locally and deploy them to your instance.")
* [Set up your project](https://servicenow-prod.fluidtopics.net/3hj38VhiZtOrrrFx6HSA~g "Create the component project and the set of files required to develop a component. You can connect to your instance and create an application scope for your component, or you can reserve a scope to verify later.")
{#develop-component__ul_wb3_xbn_tkb}

## About this task

For a tutorial on developing a counter component, visit the [Developer Site](https://developer.servicenow.com/dev.do#!/guide/sandiego/now-experience/ui-framework/examples/counter).

## Procedure

1. In your project directory, navigate to src/\<component-name\>/index.js.  
   This is the primary code file for a component.
2. Add your component code.  
   This example shows a sample Hello World component.

       import {createCustomElement} from '@servicenow/ui-core';
       import snabbdom from '@servicenow/ui-renderer-snabbdom';
       import styles from './styles.scss';

       const view = (state, {updateState}) => {
       	return (
       		<div>Hello World!</div>
       	);
       };

       createCustomElement('hello-world', {
       	renderer: {type: snabbdom},
       	view,
       	styles
       });

   To develop a component for Virtual Agent, add specific properties and actions to interact with the Virtual Agent client interface. The properties required depend on the type of component you are creating. For more information, see [Develop a component for Virtual Agent](https://servicenow-prod.fluidtopics.net/ikd6MWrmTkXdXRzUhm9dQQ "Create a custom Virtual Agent component to gather input or display information in the Virtual Agent client interface.") for more information.
3. **Optional:** Add inner components.  
   An inner component is a component included in another component. For example, a card component might include a separate button component. The button component becomes an inner component that you must import, install, and define in the card component project.
   1. Install the inner component package by executing the install command using your system's command-line tool:  

          npm install @servicenow/<now-inner-button> 

   2. Add an import statement to the top of your index.js file:  

          import '@servicenow/<now-inner-button>';

   3. Use the inner component in your index.js file:  

          <now-inner-button label="Click Me" />

   4. List the inner component in the `components.[component-name].innerComponents` array in the now-ui.json configuration file.  

          {
            "components": {
              "now-chart-timeseries": {
                "innerComponents": [
                  "now-inner-button"
                ],

   {#develop-component__substeps_k24_rsd_qjb}
4. Run the development server command to view your component in a test browser.  

       $ snc ui-component develop [--entry entry --open --port port --host host]

   Pass in values for these arguments.  
   {#develop-component__table_lnx_bzt_vkb__entry__2}

   | Name | Description |
   |-|-|
   | entry | Path to the test module in your component project. Default: example/index.js. |
   | open | Opens the default browser and navigates to the test page. Default: false. |
   | port | Port where the development server runs. Default: 8081. |
   | host | Host address to use if you want your local development server to be accessible externally by others. Typically set to `0.0.0.0` |
   [ ]

   {#develop-component__table_lnx_bzt_vkb}  

       $ snc ui-component develop --entry example/hello.js --open --port 3000

## What to do next

[Deploy a component to an instance](https://servicenow-prod.fluidtopics.net/MEztUtnVVo3baJd3KAKLmw "Deploy your component to display in your instance as an application plugin.").
**Related concepts**   

* [Create custom components using ServiceNow CLI](https://servicenow-prod.fluidtopics.net/KY_xJD~3ToQMolg1ly161g "Develop custom components using the Next Experience UI Framework and the ui-component extension.")

