Reusable components is something that WordPress lacks outside of Blocks. Celeste brings components to your templates and if you’ve used React or any other frontend framework before, they should feel familiar.

<Icon name="arrow-right" />

Creating Components

The simplest way to get started creating components is via Celeste’s WP CLI integration. If you’re using Local to develop, you should first check the setup guide to make sure your command line has database access.

To create a new component, run the following command

wp celeste add component

This will run you through a wizard, where you can select which files are created for you:

Screenshot 2024-05-24 at 14.57.26.png

The available options are:

Component Structure

At their most basic, components require a Twig template inside a directory of their name:

views/
	components/
		Example/
			template.twig

They may also include some other files, which Celeste can use to make the development experience nicer, such as compiling CSS and JS for you.

views/
	components/
		Example/
			component.php
			main.js
			style.css
			template.twig