Getting Started

Building Your First Site

In this guide, you will learn how to build a three-page site for an agency. This step-by-step process will cover key concepts, including layouts, pages, sections, styling, data binding, and publishing.

Download and Install

Download and install the desktop app from the download page. Launch the Clutch Desktop and create an account to get started.

Create A Project

After logging in, you'll land on your Dashboard.
Click the New Project button and select Blank Project.
💡
For more information about templates, see the Project Templates documentation.

Editor Overview

Image without caption
  • Navigator: Navigate project assets, including site pages, components, and boards.
  • Quick Add Strip: Quickly add common components like Box, Text, and Logic to your composition.
  • Composition Tree: View and manage the hierarchical structure of the current page or component.
  • Properties Panel: Configure component settings with a dynamic, contextual interface for customization, styling, and data binding.
  • Application Bar: Manage project-wide actions, including Tokens, Classes, the Insert Menu, sharing, and publishing.
  • Canvas: Select, interact with, and edit site contents.

Add a Layout

To add a layout open the Insert Menu and select the Blank Layout.
Image without caption
A layout will come with a nested page this will be used to build out the home page.
Image without caption
Change the Name of the page in the Properties Panel to Home.
Image without caption
💡
Layouts let you reuse sections, components, and UI elements, such as navbars and footers, across multiple pages.

Add a Page

Next, we’ll create an About page and Contact page.
Open the Insert Menu and select Blank Page.
Image without caption
Now update the newly inserted page properties in the Properties Panel:
  • Name: Set to About.
  • Path: Set to /about.
Image without caption
You have now created the foundation of your About page.
Repeat the same steps to create the Contact page:
  1. Add a Blank Page.
  1. Update the Name to Contact.
  1. Set the Path to /contact.
Your site now has an About page and a Contact page, we will content to these pages in the next steps using Sections and Components.
💡
Pages define routes and views for your site. Each page displays unique content while reusing elements from the layout. Learn more

Add a Section

By now, your project should include a Layout with three pages: Home, About, and Contact. In this section, you'll add content to these pages using Sections. By the end, your site will include:
  • A Navbar in the Layout
  • A Hero section on the Home page
  • A Form on the Contact page

Add a Navbar to the Layout

  1. Select the Layout in the Navigator to begin editing it.
  1. Open the Insert Menu and navigate to Sections.
  1. Choose a Navbar and add it to the Layout.

Add a Hero Section to the Home Page

  1. Select the Home page in the Navigator.
  1. Open the Insert Menu and navigate to Sections.
  1. Choose a Hero section and add it to the Home page.

Add a Hero Section to the About Page

Repeat the steps above to add a section(s) to the About page.

Add a Form to the Contact Page

  1. Select the Contact page in the Navigator.
  1. Open the Insert Menu and navigate to Sections.
  1. Choose a Form section and add it to the Contact page.
💡
Sections are standalone units of composition, such as navbars, heroes, product lists, or sign up forms.

Edit the Composition

In this section, you’ll learn how to rearrange components within a section to adjust the design layout. Reordering components allows you to customize your design and create the exact layout you need. Let’s walk through two examples: reordering Navbar links and rearranging text in the Hero section

Reordering Links in the Navbar

  1. Select the Navbar
      • Use Navigator switch to edit the Layout and select the Navbar.
  1. Locate the Links
      • In the Composition Tree, expand the Navbar to see its child components. Locate the About and Contact links.
  1. Drag and Drop
      • Click and drag the Contact link in the Composition Tree and move it above the About link.
💡
You can also edit the composition directly on the Canvas by dragging and dropping components. Both the Composition Tree and the Canvas provide real-time visual feedback.

Rearrange Text in the Hero Section

  1. Select the Home Page
      • Open the Navigator and select the Home page to start editing.
  1. Select the Hero Section Title Text
      • On the Canvas, click the Title Text in the Hero section.
      • The Composition Tree will highlight the selected component, confirming you’ve selected the correct one.
  1. Reorder the Text
      • Drag the Title Text on the Canvas and move it below the Subtitle component.
Duplicate components using cmd + d. Multi-select components to wrap them in a new component or move them to another section in a single action.
💡
Multi-select, duplicate, convert, and wrap in are other tools available to enhance your editing experience. Learn more about these tools in the documentation.

Styling

Styling brings your project to life by customizing components to reflect your brand. In this section, you’ll learn how to style your site using instance styling, tokens, and classes. By the end, your three-page agency site will have a polished, professional look.

Instance Styling

Instance styling allows you to apply unique styles to individual components. Let’s style the Hero Section on the Home page.
  1. Select the Home Page
      • Open the Navigator and select the Home page.
  1. Edit the Hero Section Background
      • Click on the Hero Section in the Canvas to select it.
      • In the Properties Panel, set the Background Color to a color of your choice.
  1. Adjust Font Size for the Title
      • Click on the Title Text in the Hero Section.
      • In the Properties Panel, increase the Font Size for emphasis.

Tokens

Tokens are reusable values for styles like colors or spacing, ensuring consistency across your site. Let’s create and apply a token for the primary color.
  1. Create a Color Token
      • Select the Navbar component in the Canvas.
      • In the Properties Panel, locate the Background Color property.
      • Click Bind next to the property, then click the plus button to create a new token. Name it Primary.
  1. Apply the Token
      • Use the same Primary token for the Hero Section background on all three pages to ensure design consistency.
  1. Manage Tokens
      • Access and edit all tokens from the Tokens Menu in the Application Bar.

Classes

Classes allow you to apply shared styles across multiple components, making updates simple and consistent. Let’s create a class for your site’s buttons.
  1. Style a Button Instance
      • Select a Button in the Hero Section of the Home page.
      • In the Properties Panel, customize its Background Color, Font Size, and Padding.
  1. Convert to a Class
      • Click Convert to Class in the Classes Panel and name it Primary Button.
  1. Reuse the Class
      • Apply the Primary Button class to buttons on the About and Contact pages for consistent styling.
💡
For advanced styling methods, see the Styling Documentation.

Connect Data

In this section, you’ll learn how to use Clutch’s data primitives to connect your site to external data. We’ll create a Testimonials section on the Home page that dynamically displays content fetched from an API.

Add a Data Primitive

  1. Select the Home Page
      • Use the Navigator and select the Home page.
  1. Add a Data Primitive
      • Use the Quick Add Strip to drag a Data Primitive into the Composition Tree under the Home page. This primitive will manage the data you’ll fetch.

Create a Query to Fetch Testimonials

  1. Open the Query Menu
      • In the Properties Panel, locate the Query option for the Data Primitive and click Create New Query.
      Image without caption
      • This will open your default code editor and generate a basic boilerplate query in the queries folder of your codebase.
  1. Configure the Query
      • You can ignore or delete the boilerplate code and replace it with the following query:
      typescript
      /** * Fetches testimonials from the FakerAPI. * * @returns A promise that resolves to an array of testimonials. * @throws If there is an error fetching the testimonials. */ export async function getTestimonials(): Promise<Object> { const url = 'https://fakerapi.it/api/v2/texts?_quantity=5&_characters=256'; const response = await fetch(url, { next: { revalidate: 3600, // cache for 1 hour tags: ['testimonials'], }, }); if (!response.ok) { throw new Error('Failed to fetch testimonials'); } return await response.json(); }
  1. Save the Query
      • Save the file after replacing the code. This query will now fetch testimonials from the specified API.
  1. Test the Query
      • Return to Clutch and select the newly created query in the Properties Panel.
      • When a query is selected, and the Data Primitive has no children, Clutch automatically renders the returned data on the Canvas for easy visualization.
      💡
      Queries can also be tested using the Properties Panel. Select the query input and click Run test.

Add a Loop Primitive to Display Testimonials

  1. Add a Loop Primitive
      • Use the Quick Add Strip to drag a Loop Primitive into the composition under the Data Primitive.
  1. Bind the Loop to the Query Data
      • In the Loop Primitive’s Properties Panel, use the Bind menu to bind the loop to the data array returned by your query. This will iterate through the 5 testimonials.

Add Text to Display Each Testimonial

  1. Add a Text Primitive Inside the Loop
      • Drag a Text Primitive into the Loop Primitive. This text will display individual testimonials.
  1. Bind the Text to the Loop Item
      • In the Text Primitive’s Properties Panel, use the Bind menu to bind the text to the current item in the loop. Select the field in the data array containing the testimonial text.
  1. Preview the Testimonials
      • Switch to Preview Mode to see the Testimonials section populated with live data.
💡
Your Home page now includes a Testimonials section that fetches and displays data dynamically. For more advanced data-binding techniques, see the Data Documentation.

Extend Clutch

Clutch can be extended with custom components, queries, actions, and helper functions to support advanced use cases. This guide outlines the basics, with links to detailed documentation for in-depth guidance.
Components: Create reusable custom or code-based components.
Actions: Perform operations or trigger workflows based on user interactions.
Helper Functions: Define and reuse custom logic to simplify workflows.
For detailed steps and advanced techniques, see the Advanced Development Documentation.

Components

Components can be created by switching the project's mode to Components Mode using the navigator.
In this mode, you’ll find a plus sign to the right of the navigator. Selecting this gives you the option to create a composed component or a code component.
Composed Components
To create a composed component, set the type to Composed and give it a name. For example, name the component MyHeader and click Create. A new workspace will be created where you can compose this component.
The component will include a preconfigured Box and a children slot. You can ignore the slot for now; details on using slots are available in the components documentation. Drag a Text component into the composition, placing it as a child of the Box. Use the Bind menu to set the font size of the Text component to a scale token of 4xl.
You now have a basic Header Component that can be added to a page. This example introduces composed components, with more advanced use cases covered in the components documentation.
Code Components
Code components are built using TypeScript and export a React functional component. To create a code component, start by opening the Code Files of your project. Create a new folder (e.g., components) and add an index.tsx file inside it.
Write your code component as a React functional component. For example:
typescript
export default function MySubheader({ className, text }: { className?: string; text: string }) { return <p className={className}>{text}</p>; }
This code component accepts className for styling through the style panel and text for custom content.
Next, in Components Mode within Clutch, follow the steps to create a component. Set the type to Code and name it (e.g., MySubheader). This creates a workspace for the code component.
To use the code component, open the Insert Menu, search for your component, and add it to the workspace. You can now work with it visually while retaining full functionality from your TypeScript code.

Actions

Creating an action guide

Helper Functions

This guide explains how to create a basic helper function. For more advanced techniques, refer to the Helper Functions Documentation.
Let’s create a helper function to truncate text to a specified number of words and append an ellipsis.
First, select a Text component or add a new one. Open the Bind Menu, navigate to the Functions tab, and click the + button to create a new functions file. A boilerplate file will appear, which you can ignore or remove. Below the boilerplate code, add the following function:
typescript
/** * Truncates text to a specified number of words and adds an ellipsis. * * @param text - The text to truncate. * @param wordLimit - The number of words to limit to (default is 10). * @returns The truncated text with an ellipsis. */ export function truncateText(text: string, wordLimit: number = 10): string { const words = text.split(' '); if (words.length <= wordLimit) { return text; } return words.slice(0, wordLimit).join(' ') + '...'; }
Save the file after adding the code.
Now, return to Clutch and bind the Text component to this function. Pass in the desired sentence and word limit as arguments. You’ve successfully created and applied your first helper function.

Publishing

Once your site is ready, you can publish it to Clutch Hosting to make it live.
Opening the Publish Menu provides one-click options like Template, Staging, Marketplace, and Production. To learn more about these configurations, see the Publishing Documentation.
For this guide, simply click the Publish button next to Production to deploy the current version of your site.
Your site will now be live and accessible on the web. You can continue to make updates and publish changes at any time.

Powered by Notaku