---
title: Create a component
description: Learn to build components from scratch or extract them from existing elements to create reusable building blocks in your Nordcraft project.
---

# Create a component

There are two ways to create components in Nordcraft:

- [Create from scratch](#create-from-scratch)
- [Extract existing elements](#extract-existing-elements)

## Create from scratch

![The create component dialog is open where you can choose a name for your component. The components list is visible on the left after clicking the Components button in the activity bar.|16/9](create-from-scratch.webp 'Create from scratch'){https://editor.nordcraft.com/projects/docs_examples/branches/main/components/screenshot-page?canvas-width=800&canvas-height=800&rightpanel=style&leftpanel=components}

To create a new component from scratch, you can use the command palette or the sidebar:

### Using the command palette (recommended)

1. Press [kbd]Cmd/Ctrl[kbd] + [kbd]Shift[kbd] + [kbd]K[kbd] to open the [command palette](/the-editor/command-palette) in action mode
2. Select **Create component** (or type "Create component" and press [kbd]↵[kbd])
3. Enter a name for your component and confirm with [kbd]Create[kbd]

### Using the sidebar

1. Click the [kbd]Components[kbd] button in the left sidebar to open the list of components
2. Click the [kbd]+[kbd] button at the top of the list
3. Enter a name for your component and confirm with [kbd]Create[kbd]

::: tip
If a component's name includes dashes (-), the component will be grouped in the components list. For example, a component named `onboarding-component` will be grouped under `onboarding` in the list. This is useful when you have multiple components that are part of the same feature.
:::

## Extract existing elements

![The context menu that appears when you right-click an element in the HTML element tree is visible, showing extract as component highlighted. The create component dialog is visible at the center of the screen, allowing you to name the new component that you are extracting.|16/9](extract-as-component.webp 'Extract as component'){https://editor.nordcraft.com/projects/docs_examples/branches/main/components/screenshot-page?canvas-height=800&canvas-width=800&selection=nodes.m6MApQ1ZZSiZ5iH6kAUWE&rightpanel=style}

To convert existing elements into a component:

1. Select the element you want to convert in the [element tree](/the-editor/element-tree)
2. Right-click and select [kbd]Extract as component[kbd] from the context menu
3. Enter a name for the new component and confirm with [kbd]Create[kbd]

This method automatically:

- Creates a new component with the selected element's structure
- Replaces the original elements with an instance of the new component
- Preserves the original appearance and behavior

::: warning
If the extracted elements depend on variables or formulas from the original component or page, these connections will break after extraction. You will need to rearrange these dependencies.
:::

::: tip
For a video walkthrough of creating a component, check out the following lesson from the [Nordcraft Fundamentals](https://nordcraft.com/learn/fundamentals) video course.
:::

@@@ youtube
videoId: JFKB1IbReyE
title: Creating and using components
@@@
