User Interface
Raycast uses React for its user interface declaration and renders the supported elements to our native UI. The API comes with a set of UI components that you can use to build your extensions. Think of it as a design system. The high-level components are the following:
  • List to show multiple similar items, f.e. a list of your open todos.
  • Detail to present more information, f.e. the details of a GitHub pull request.
  • Form to create new content, f.e. filing a bug report.
Each component can provide interaction via an ActionPanel. The panel has a list of Actions where each one can be associated with a keyboard shortcut. Shortcuts allow users to use Raycast without using their mouse.

Rendering

To render a user interface, you need to do the following:
As a general rule of thumb, you should render something as quickly as possible. This guarantees that your command feels responsive. If you don't have data available to show, you can set the isLoading prop to true on top-level components such as <Detail>, <Form>, or <List>. It shows a loading indicator at the top of Raycast.
Here is an example which shows a loading indicator for 2 seconds after the command got launched:
1
import { List } from "@raycast/api";
2
import { useEffect, useState } from "react";
3
4
export default function Command() {
5
const [isLoading, setIsLoading] = useState(true);
6
7
useEffect(() => {
8
setTimeout(() => setIsLoading(false), 2000);
9
}, []);
10
11
return <List isLoading={isLoading}>{/* Render your data */}</List>;
12
}
Copied!
Copy link
Edit on GitHub
Contents
Rendering