Skip to main content
All CollectionsDesigning in Subframe
Creating custom components
Creating custom components

How to create a component from scrach

Filip Skrzesinski avatar
Written by Filip Skrzesinski
Updated over a week ago

Components are reusable building blocks for your UI. In addition to the included design system components you can create your own custom components that are shared across both design & code.

๐Ÿ› ๏ธ Whenever you create new components, run the CLI command to sync your changes with your codebase.


Create a component

You can create a component from any existing element, or build one from scratch.

Create from an existing design

  1. Select the layers to include in your component.

  2. Right-click on your selection.

  3. ClickCreate component in the dropdown menu.

  4. Name your component and select any suggested properties to include.

  5. Subframe will open the component editor, where you can further edit your component.

Create from scratch

  1. Go to your component library.

  2. Click + New component.

  3. Subframe will create a new blank component and open te


Component properties

Just like in code, components use properties to display different data when you use them. Defining properties lets you:

  • Change icon, text, or images

  • Create variants of a component

  • Add custom elements with slots

Suggested properties

When you create a component from existing layers, Subframe will suggest properties for the component to get you started. You'll be able to modify this later.

  • Rename the property using the text field (e.g. image, text)

  • Remove properties you don't need using the toggle switch


Interaction states

You can easily add interactive states to any component, including:

  • Hover

  • Pressed

  • Focused

Did this answer your question?