Component Basics

What are components in Ditto? Components are text items that are synced across projects and stored in the Component Library for your workspace. Edits to the text or meta-data of a component propagate to all of its instances.

Components allow you to:

  • centralize your team’s copy into a searchable, standardized library
  • reduce time spent manually copying + pasting edits to repeated text across screens
  • allow designers to reuse pre-approved, standardized text in their mocks

When do I start creating components?

We've seen that teams get the most out of Ditto when they starting creating components as early as possible! You'll eventually want to componentize every piece of text in your projects as it will make that text a lot easier to reuse across projects, as well as connect to design and development.

Some key terms to help you get started:

  • Instance - an instance of a component is a text item currently attached to a component. Edits to an instance sync with all instances of the same component.
  • Attaching - attaching a text item in a project to a component turns it into an instance of the component. A text item can be attached to either an existing component or a new component based on the current text.
  • Detaching - detaching a text item unlinks the text item from the component. After detaching from a component, edits to the text item are no longer linked with the instances of the component.

🎒

Resource: Want to try out creating and attaching components in a low-stakes sandbox? Check out our 🌐Ditto Components Playground (Figma Community File)!

Creating your first component

To create your first component, click a text item in a project and select "create or attach component" in the edit panel.

This will open a modal where you can name your new component (or attach it to existing components once you have others in the component library!). You can view all of the components in your workspace by clicking the "Components" tab at the top of the web-app.

💡

Not sure what to componentize? Check out the auto-generated Component Suggestions for your project!

🖋 Drafting Components

You can also draft Ditto Components in your Component Library, without having to create Components from existing text in Figma files! This means being able to create a content component library directly in Ditto that anyone from your team can bring into their projects.

To draft a component, just click the "+ New Component" button in the top right of your Component Library. Drafted components not yet attached in projects will appear as yellow.

🔗 Attaching to existing components

To attach a text item to an existing component, select the name of the component in the modal's dropdown. A preview of the component's text will display as a diff from the item's current text.

Once you attach the text to a component, its text will turn into an "instance" of the component. Edits to the text will be synced with all other instances of the component until it is detached.

You can also browse your component library and reuse text from it directly in the Figma plugin, without leaving the Figma file!

🪓 Detaching instances from components

To detach an instance from its component, click the three dots next to the component name in the edit panel. Click "Detach from component". Once you do this, this text item will become a regular text item, and edits will no longer be synced with the component.

Keep in mind, however, that if a component has no instances (i.e. all of its instances have been detached), it will be removed from your component library.

🖋 Renaming components

You can rename a component at any time by selecting the component in the component library and clicking the pen icon next to its name. It'll open a modal where you can rename the component. We have more about how you can use the name of a component to organize your component library here.

🔌 Using components from the Plugin

When you select text in Figma, you can also attach and create new components from the "Selected" tab of the Ditto Figma plugin.

When you attach text in Figma to a Ditto component, you'll notice a 🟣 icon for the text in the layer name. The text node in the file will continue to be synced as a Ditto component!

In our Figma plugin, you're also able to view Component Suggestions in the "Components" tab. Here, Ditto components most similar to text in the project can be viewed and attached. For more about Component Suggestions, check out this Help Guide.

Didn't find what you were looking for?
Contact Support