Get started with extension UI
This page will help you get started with creating an extension that uses extension UI. It describes how to generate the boilerplate code for extension UI, what the required files and basic scaffolding are, and how to preview your UI with the Netlify SDK commands.
The Netlify SDK provides a React-based toolkit for building an extension UI. It assumes a basic working knowledge of React.
Prerequisites
Windows users should run the Netlify SDK through WSL 2
Support for using the Netlify SDK on Windows is currently only available through WSL 2.
- Node.js 18.19.0 or later
- Netlify CLI
- TypeScript
Extension UI uses the following technical stack. It might be helpful to familiarize yourself with these tools and libraries:
Tech stack
Create your extension UI
-
To get started, run the following command to create a new extension:
-
Then, follow the prompts to add the
Extension UI
boilerplate.The Netlify SDK will scaffold the basic structure needed for the extension UI, which includes the following files:
When you build or run your extension, Vite (the default build tool) references the
src/ui/index.html
file in your extension directory. Vite then builds your single-page application to a directory, and the Netlify SDK uses your built application as the extension UI’s entrypoint.
The following sections provide detail on each file and the boilerplate code each one contains.
Extension UI files
When you use the SDK’s guided set-up flow, the SDK outputs the following boilerplate files. The files include a sample extension UI configured for the extension details page surface, which users will access under Extensions > [your extension’s details page] > Configuration in the Netlify UI.
src/ui/index.tsx
The src/ui/index.tsx
file contains the root of the application that represents your extension UI:
This file contains the code that bootstraps the application and sets up plumbing between the Netlify UI and your application. You won’t need to modify this file frequently. However, you might add global setup here, such as a new stylesheet.
src/ui/App.tsx
The src/ui/App.tsx
file contains application-specific logic for your extension UI:
This component receives the current surface the end user is viewing and renders the appropriate component. This is also a good place to add any React providers your application might need.
src/ui/surfaces/TeamConfiguration.tsx
Inside the src/ui/surfaces/TeamConfiguration.tsx
file, you’ll find sample UI for the extension details page surface:
You can add UI and logic to this page to collect team-specific configuration values.
extension.yaml
This is the extension configuration file and this is where you specify the surfaces that the extension contains. The Netlify UI will read this configuration file and use this to identify when to render your extension UI application.
In this case, you will find that the extension UI is configured for the extension details page surface:
Next steps
To preview your extension UI while you develop locally, you need to deploy and publish it as a private extension first. Learn more about how to develop locally.
For more information about all of the components and surfaces available, refer to the extension UI reference docs.