Ask toddle AI

๐Ÿ 

Docs home

๐Ÿ‘ถ

Getting started

๐ŸŽ“

1st week in toddle

๐Ÿ› ๏ธ

The editor

๐Ÿงฑ

Elements

๐Ÿ’…

Styling and layout

๐Ÿ“ฆ๏ธ

Components

๐Ÿ“„

Pages and navigation

โ˜๏ธ

Working with APIs

๐Ÿงฎ

Formulas

๐Ÿ””

Events and actions

๐Ÿ“ฆ

Packages

๐Ÿค–

Custom code

๐Ÿ‘ฏโ€โ™‚๏ธ

Integrations

๐Ÿฟ

Tutorials

๐Ÿงฐ

Other

Working with components

Components are the building blocks of toddle applications. Components lets you reuse generic parts of your application like a Navigation bar or a Popup. Components are also a great way to break large applications down in to smaller more manageable building blocks.

Components can render elements on a page, store data in variables, call APIs etc. You can kind of think of them as tiny web applications on their own.

Components in toddle encapsulates their data. This means that the variables and APIs of one component are not accessible by other components. Initially this can seem unnecessarily restrictive, but it is a critical property that lets you reason about your application as the number of components grow.

Components are composable

Components in toddle can be composed together to form more complex components which then in turn can be composed into full applications.

And application like the toddle editor contains dozens of API calls, and thousands of variables. Trying to keep all that information in your head ad one time would be impossible. Using components we can split the editor into hundreds of smaller components, each responsible for a small part or the application.
element-panel being developed in the toddle editor.

Components can send data to other components and pages through Attributes and Events .

Creating a new component

There are two ways you can create a new component. You can create a new component from the project sidebar by clicking "Create new" followed by "New component".

Create a new component from the project sidebar.

The other option is to right click an element inside the element tree and choose extract as component.

Create new component from the element tree
Components in toddle follow the naming restrictions of web-components . A component must have at least two parts to their name joined together by a hyphen "-", Component names cannot contain any special characters.

You can read more about how to use components in toddle in Component elements

Learn more about components:

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code โ€” but accessible to your entire team!

Try toddle โ€” it's free!
Server-side rendered Installable PWAs Connect to any database As performant as code toddle is built in toddle undefined undefined undefined undefined undefined
undefined Style tokens Export as web components No feature limits Connec to any API Extend with code undefined undefined undefined undefined

ยฉ Copyright 2024 toddle. All rights reserved.