string
|
| options | Options to control which and how the AI model should behave. | AI.AskOptions
|
#### Return
A Promise that resolves with a prompt completion.
## Types
### AI.Creativity
Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
```typescript
type Creativity = "none" | "low" | "medium" | "high" | "maximum" | number;
```
If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
### AI.Model
The AI model to use to answer to the prompt. Defaults to `AI.Model["OpenAI_GPT3.5-turbo"]`.
#### Enumeration members
| Model | Description |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OpenAI_GPT4 | GPT-4 is the model with broad general knowledge, allowing it to follow complex instructions and solve difficult problems. This model is the previous generation, use GPT-4o for better results. |
| OpenAI_GPT4-turbo | GPT-4 Turbo is an evolution of the GPT-4 model with a larger context. This model is the previous generation, use GPT-4o for better results. |
| OpenAI_GPT4o | GPT-4o is the most advanced and fastest model from OpenAI, making it a great choice for complex everyday problems and deeper conversations. |
| OpenAI_GPT4o-mini | GPT-4o mini is a highly intelligent and fast model that is ideal for a variety of everyday tasks. |
| OpenAI_o1-preview | OpenAI o1-preview is an advanced reasoning model designed to tackle complex problems in science, coding, mathematics, and similar fields. |
| OpenAI_o1-mini | OpenAI o1-mini is a faster, more cost-effective reasoning model particularly effective at coding tasks. |
| OpenAI_o1 | OpenAI o1 is an advanced reasoning model designed to tackle complex problems in science, coding, mathematics, and similar fields. |
| OpenAI_o3-mini | OpenAI o3-mini is a fast and powerful reasoning model optimized for STEM tasks like science, math, and coding. It offers advanced features like web search making it ideal for complex problem-solving with reduced latency. |
| Anthropic_Claude_Haiku | Claude 3.5 Haiku is Anthropic's fastest model, with a large context window that makes it ideal for analyzing code, documents, or large amounts of text. |
| Anthropic_Claude_Sonnet | Claude 3.5 Sonnet from Anthropic has enhanced intelligence with increased speed. It excels at complex tasks like visual reasoning or workflow orchestrations. Currently points to claude-3-5-sonnet-20241022. |
| Anthropic_Claude_Sonnet_3.7 | Claude 3.7 Sonnet is Anthropic's most intelligent model |
| Anthropic_Claude_Opus | Claude 3 Opus is Anthropic's intelligent model designed to solve highly complex tasks. It stands out for its remarkable fluency. |
| Perplexity_Sonar | Lightweight Perplexity model with search grounding, quicker than Sonar Pro |
| Perplexity_Sonar_Pro | Premier Perplexity model with search grounding, supporting advanced queries and follow-ups |
| Perplexity_Sonar_Reasoning | Lightweight reasoning offering powered by reasoning models trained with DeepSeek R1. |
| Perplexity_Sonar_Reasoning_Pro | Premier reasoning offering powered by DeepSeek R1. |
| Llama4_Scout | Llama 4 Scout is a cutting-edge multimodal model with 17 billion active parameters and 16 experts, designed for state-of-the-art performance in its class. |
| Llama3.3_70B | Llama 3.3 70B is an open-source model from Meta, state-of-the-art in areas like reasoning, math, and general knowledge. |
| Llama3.1_8B | Llama 3.1 8B is an open-source model from Meta, optimized for instruction following and high-speed performance. |
| Llama3_70B | Llama 3 70B from Meta is a highly capable open-source LLM that can serve as a tool for various text-related tasks. |
| Llama3.1_405B | Llama 3.1 405B is Meta's flagship open-source model, offering unparalleled capabilities in general knowledge, steerability, math, tool use, and multilingual translation. |
| Mistral_Nemo | Mistral Nemo is a small model built in collaboration with NVIDIA, and released under the Apache 2.0 license. |
| Mistral_Large | Mistral Large is Mistral's top-tier reasoning model for high-complexity tasks with stronger multilingual support. Currently points to mistral-large-2411 |
| Mistral_Small | Mistral Small is Mistral's latest enterprise-grade small model that delivers significant improvements in human alignment, reasoning capabilities, and code. Currently points to mistral-small-2503 |
| Mistral_Codestral | Codestral is Mistral's cutting-edge language model that specializes in low-latency, high-frequency tasks such as fill-in-the-middle (FIM), code correction and test generation. Currently points to codestral-2501 |
| DeepSeek_R1_Distill_Llama_3.3_70B | DeepSeek R1 Distill Llama 3.3 70B is a fine-tuned version of Llama 3.3 70B, leveraging DeepSeek-R1's advanced capabilities for enhanced reasoning and precision. |
| Qwen_2.5_32B | Qwen-2.5-32B is Alibaba's flagship model, delivering near-instant responses with GPT-4 level capabilities across a wide range of tasks. |
| Google_Gemini_2.5_Pro | Gemini 2.5 is a thinking model, designed to tackle increasingly complex problems. |
| Google_Gemini_2.0_Flash | Google's powerful workhorse model with low latency and enhanced performance, built to power agentic experiences |
| Google_Gemini_2.0_Flash_Thinking | Gemini 2.0 Flash Thinking is an experimental model that generates its internal reasoning process, enabling stronger analytical capabilities |
| DeepSeek_R1 | Fully open-source model with performance on par with OpenAI-o1 |
| DeepSeek_V3 | Mixture-of-Experts model challenging top AI models |
| xAI_Grok_3 | Grok-3 is xAI's flagship model that excels at enterprise use cases like data extraction, coding, and text summarization. Always uses fast-mode |
| xAI_Grok_3_Mini | Grok-3 Mini is xAI's lightweight model that thinks before responding. Fast, smart, and great for logic-based tasks that do not require deep domain knowledge. Always uses fast-mode |
| xAI_Grok_2 | Grok-2 is xAI's frontier language model with state-of-the-art reasoning capabilities |
If a model isn't available to the user, Raycast will fallback to a similar one:
- `AI.Model.OpenAI_GPT4`, `AI.Model["OpenAI_GPT4-turbo"]`, and `AI.Model.OpenAI_GPT4o` -> `AI.Model["OpenAI_GPT4o-mini"]`
- `AI.Model["OpenAI_o1-preview"]`, `AI.Model["OpenAI_o1-mini"]`, and `AI.Model.OpenAI_o1` -> `AI.Model["OpenAI_GPT4o-mini"]`
- `AI.Model.Anthropic_Claude_Opus`, `AI.Model.Anthropic_Claude_Sonnet`, and `AI.Model["Anthropic_Claude_Sonnet_3.7"]` -> `AI.Model.Anthropic_Claude_Haiku`
- `AI.Model.Perplexity_Sonar_Pro` -> `AI.Model.Perplexity_Sonar`
- `AI.Model.Mistral_Large` -> `AI.Model.Mistral_Nemo`
- `AI.Model["Llama3.1_405B"]` -> `AI.Model["Llama3.3_70B"]`
- `AI.Model.DeepSeek_R1` -> `AI.Model["DeepSeek_R1_Distill_Llama_3.3_70B"]`
- `AI.Model.xAI_Grok_2` -> `AI.Model["OpenAI_GPT4o-mini"]`
- `AI.Model.xAI_Grok_3` -> `AI.Model.xAI_Grok_3_Mini`
- `AI.Model["Google_Gemini_2.5_Pro"]` -> `AI.Model["Google_Gemini_2.0_Flash"]`
### AI.AskOptions
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| creativity | Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more. If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used. | AI.Creativity
|
| model | The AI model to use to answer to the prompt. | AI.Model
|
| signal | Abort signal to cancel the request. | [Date](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
# Browser Extension
The Browser Extension API provides developers with deeper integration into the user's Browser _via_ a [Browser Extension](https://raycast.com/browser-extension).
{% hint style="info" %}
Some users might not have installed the Browser Extension. If a user doesn't have the Browser Extension installed, they will be asked if they want to install it when your extension calls the Browser Extension API. If the user doesn't wish to install it, the API call will throw an error.
You can check if a user has the Browser Extension installed using `environment.canAccess(BrowserExtension)`.
{% endhint %}
## API Reference
### BrowserExtension.getContent
Get the content of an opened browser tab.
#### Signature
```typescript
async function getContent(options?: {
cssSelector?: string;
tabId?: number;
format?: "html" | "text" | "markdown";
}): PromiseObject
|
| options.cssSelector | Only returns the content of the element that matches the [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors). If the selector matches multiple elements, only the first one is returned. If the selector doesn't match any element, an empty string is returned. When using a CSS selector, the `format` option can not be `markdown`. | string
|
| options.format | The format of the content. - `html`: `document.documentElement.outerHTML` - `text`: `document.body.innerText` - `markdown`: A heuristic to get the "content" of the document and convert it to markdown. Think of it as the "reader mode" of a browser. | "html"
or "text"
or "markdown"
|
| options.tabId | The ID of the tab to get the content from. If not specified, the content of the active tab of the focused window is returned. | number
|
#### Return
A Promise that resolves with the content of the tab.
### BrowserExtension.getTabs
Get the list of open browser tabs.
#### Signature
```typescript
async function getTabs(): Promiseboolean
|
| id* | The ID of the tab. Tab IDs are unique within a browser session. | number
|
| url* | The URL the tab is displaying. | string
|
| favicon | The URL of the tab's [favicon](https://developer.mozilla.org/en-US/docs/Glossary/Favicon). It may also be `undefined` if the tab is loading. | string
|
| title | The title of the tab. It may also be `undefined` if the tab is loading. | string
|
# Caching
Caching abstraction that stores data on disk and supports LRU (least recently used) access. Since extensions can only consume up to a max. heap memory size, the cache only maintains a lightweight index in memory and stores the actual data in separate files on disk in the extension's support directory.
## API Reference
### Cache
The `Cache` class provides CRUD-style methods (get, set, remove) to update and retrieve data synchronously based on a key. The data must be a string and it is up to the client to decide which serialization format to use.
A typical use case would be to use `JSON.stringify` and `JSON.parse`.
By default, the cache is shared between the commands of an extension. Use Cache.Options.
#### Signature
```typescript
constructor(options: Cache.Options): Cache
```
#### Example
```typescript
import { List, Cache } from "@raycast/api";
type Item = { id: string; title: string };
const cache = new Cache();
cache.set("items", JSON.stringify([{ id: "1", title: "Item 1" }]));
export default function Command() {
const cached = cache.get("items");
const items: Item[] = cached ? JSON.parse(cached) : [];
return (
boolean
|
#### Methods
| Method |
| :------------------------------------------------------------------------------------------- |
| get(key: string): string \| undefined
|
| has(key: string): boolean
|
| set(key: string, data: string): void
|
| remove(key: string): boolean
|
| clear(options = { notifySubscribers: true }): void
|
| subscribe(subscriber: Cache.Subscriber): Cache.Subscription
|
### Cache#get
Returns the data for the given key. If there is no data for the key, `undefined` is returned.
If you want to just check for the existence of a key, use has.
#### Signature
```typescript
get(key: string): string | undefined
```
#### Parameters
| Name | Description | Type |
| :------------------------------------ | :-------------------------- | :------------------ |
| key\* | The key of the Cache entry. | string
|
### Cache#has
Returns `true` if data for the key exists, `false` otherwise.
You can use this method to check for entries without affecting the LRU access.
#### Signature
```typescript
has(key: string): boolean
```
#### Parameters
| Name | Description | Type |
| :------------------------------------ | :-------------------------- | :------------------ |
| key\* | The key of the Cache entry. | string
|
### Cache#set
Sets the data for the given key.
If the data exceeds the configured `capacity`, the least recently used entries are removed.
This also notifies registered subscribers (see subscribe.
#### Signature
```typescript
set(key: string, data: string)
```
#### Parameters
| Name | Description | Type |
| :------------------------------------- | :--------------------------------------- | :------------------ |
| key\* | The key of the Cache entry. | string
|
| data\* | The stringified data of the Cache entry. | string
|
### Cache#remove
Removes the data for the given key.
This also notifies registered subscribers (see subscribe.
Returns `true` if data for the key was removed, `false` otherwise.
#### Signature
```typescript
remove(key: string): boolean
```
### Cache#clear
Clears all stored data.
This also notifies registered subscribers (see subscribe unless the `notifySubscribers` option is set to `false`.
#### Signature
```typescript
clear((options = { notifySubscribers: true }));
```
#### Parameters
| Name | Description | Type |
| :------ | :------------------------------------------------------------------------------------------------------------------------- | :------------------ |
| options | Options with a `notifySubscribers` property. The default is `true`; set to `false` to disable notification of subscribers. | object
|
### Cache#subscribe
Registers a new subscriber that gets notified when cache data is set or removed.
Returns a function that can be called to remove the subscriber.
#### Signature
```typescript
subscribe(subscriber: Cache.Subscriber): Cache.Subscription
```
#### Parameters
| Name | Description | Type |
| :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------- |
| subscriber | A function that is called when the Cache is updated. The function receives two values: the `key` of the Cache entry that was updated or `undefined` when the Cache is cleared, and the associated `data`. | Cache.Subscriber
|
## Types
### Cache.Options
The options for creating a new Cache.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| capacity | The capacity in bytes. If the stored data exceeds the capacity, the least recently used data is removed. The default capacity is 10 MB. | number
|
| namespace | If set, the Cache will be namespaced via a subdirectory. This can be useful to separate the caches for individual commands of an extension. By default, the cache is shared between the commands of an extension. | string
|
### Cache.Subscriber
Function type used as parameter for subscribe.
```typescript
type Subscriber = (key: string | undefined, data: string | undefined) => void;
```
### Cache.Subscription
Function type returned from subscribe.
```typescript
type Subscription = () => void;
```
# Clipboard
Use the Clipboard APIs to work with content from your clipboard. You can write contents to the clipboard through `Clipboard.copy` function inserts text at the current cursor position in your frontmost app.
The action `Action.CopyToClipboard` can be used to insert text in your frontmost app.
## API Reference
### Clipboard.copy
Copies text or a file to the clipboard.
#### Signature
```typescript
async function copy(content: string | number | Content, options?: CopyOptions): Promisestring
or number
or Clipboard.Content
|
| options | Options for the copy operation. | Clipboard.CopyOptions
|
#### Return
A Promise that resolves when the content is copied to the clipboard.
### Clipboard.paste
Pastes text or a file to the current selection of the frontmost application.
#### Signature
```typescript
async function paste(content: string | Content): Promisestring
or number
or Clipboard.Content
|
#### Return
A Promise that resolves when the content is pasted.
### Clipboard.clear
Clears the current clipboard contents.
#### Signature
```typescript
async function clear(): PromiseObject
|
| options.offset | Specify an offset to access the Clipboard History. Minimum value is 0, maximum value is 5. | number
|
#### Return
A promise that resolves when the clipboard content was read as plain text, file name, or HTML.
### Clipboard.readText
Reads the clipboard as plain text.
#### Signature
```typescript
async function readText(options?: { offset?: number }): PromiseObject
|
| options.offset | Specify an offset to access the Clipboard History. Minimum value is 0, maximum value is 5. | number
|
#### Return
A promise that resolves once the clipboard content is read as plain text.
## Types
### Clipboard.Content
Type of content that is copied and pasted to and from the Clipboard
```typescript
type Content =
| {
text: string;
}
| {
file: PathLike;
}
| {
html: string;
text?: string; // The alternative text representation of the content.
};
```
### Clipboard.ReadContent
Type of content that is read from the Clipboard
```typescript
type Content =
| {
text: string;
}
| {
file?: string;
}
| {
html?: string;
};
```
### Clipboard.CopyOptions
Type of options passed to `Clipboard.copy`.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| concealed | Indicates whether the content be treated as confidential. If `true`, it will not be recorded in the Clipboard History. | boolean
|
# Command-related Utilities
This set of utilities to work with Raycast commands.
## API Reference
### launchCommand
Launches another command. If the command does not exist, or if it's not enabled, an error will be thrown.
If the command is part of another extension, the user will be presented with a permission alert.
Use this method if your command needs to open another command based on user interaction,
or when an immediate background refresh should be triggered, for example when a command needs to update an associated menu-bar command.
#### Signature
```typescript
export async function launchCommand(options: LaunchOptions): PromiseLaunchOptions
|
#### Return
A Promise that resolves when the command has been launched. (Note that this does not indicate that the launched command has finished executing.)
### updateCommandMetadata
Update the values of properties declared in the manifest of the current command. Note that currently only `subtitle` is supported. Pass `null` to clear the custom subtitle.
{% hint style="info" %}
The actual manifest file is not modified, so the update applies as long as the command remains installed.
{% endhint %}
#### Signature
```typescript
export async function updateCommandMetadata(metadata: { subtitle?: string | null }): Promisestring
|
| type* | LaunchType.UserInitiated or LaunchType.Background | LaunchType
|
| arguments | Optional object for the argument properties and values as defined in the extension's manifest, for example: `{ "argument1": "value1" }` | Arguments
or null
|
| context | Arbitrary object for custom data that should be passed to the command and accessible as LaunchProps; the object must be JSON serializable (Dates and Buffers supported) | LaunchContext
or null
|
| fallbackText | Optional string to send as fallback text to the command | string
or null
|
#### InterExtensionLaunchOptions
The options that can be used when launching a command from a different extension.
| Property | Description | Type |
| :--- | :--- | :--- |
| extensionName* | When launching command from a different extension, the extension name (as defined in the extension's manifest) is necessary | string
|
| name* | Command name as defined in the extension's manifest | string
|
| ownerOrAuthorName* | When launching command from a different extension, the owner or author (as defined in the extension's manifest) is necessary | string
|
| type* | LaunchType.UserInitiated or LaunchType.Background | LaunchType
|
| arguments | Optional object for the argument properties and values as defined in the extension's manifest, for example: `{ "argument1": "value1" }` | Arguments
or null
|
| context | Arbitrary object for custom data that should be passed to the command and accessible as LaunchProps; the object must be JSON serializable (Dates and Buffers supported) | LaunchContext
or null
|
| fallbackText | Optional string to send as fallback text to the command | string
or null
|
# Environment
The Environment APIs are useful to get context about the setup in which your command runs. You can get information about the extension and command itself as well as Raycast. Furthermore, a few paths are injected and are helpful to construct file paths that are related to the command's assets.
## API Reference
### environment
Contains environment values such as the Raycast version, extension info, and paths.
#### Example
```typescript
import { environment } from "@raycast/api";
export default async function Command() {
console.log(`Raycast version: ${environment.raycastVersion}`);
console.log(`Owner or Author name: ${environment.ownerOrAuthorName}`);
console.log(`Extension name: ${environment.extensionName}`);
console.log(`Command name: ${environment.commandName}`);
console.log(`Command mode: ${environment.commandMode}`);
console.log(`Assets path: ${environment.assetsPath}`);
console.log(`Support path: ${environment.supportPath}`);
console.log(`Is development mode: ${environment.isDevelopment}`);
console.log(`Appearance: ${environment.appearance}`);
console.log(`Text size: ${environment.textSize}`);
console.log(`LaunchType: ${environment.launchType}`);
}
```
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| appearance* | The appearance used by the Raycast application. | "dark"
or "light"
|
| assetsPath* | The absolute path to the assets directory of the extension. | string
|
| commandMode* | The mode of the launched command, as specified in package.json | "view"
or "no-view"
or "menu-bar"
|
| commandName* | The name of the launched command, as specified in package.json | string
|
| extensionName* | The name of the extension, as specified in package.json | string
|
| isDevelopment* | Indicates whether the command is a development command (vs. an installed command from the Store). | boolean
|
| launchType* | The type of launch for the command (user initiated or background). | LaunchType
|
| ownerOrAuthorName* | The name of the extension owner (if any) or author, as specified in package.json | string
|
| raycastVersion* | The version of the main Raycast app | string
|
| supportPath* | The absolute path for the support directory of an extension. Use it to read and write files related to your extension or command. | string
|
| textSize* | The text size used by the Raycast application. | "medium"
or "large"
|
| canAccess* | | (api: unknown) => boolean
|
### environment.canAccess
Checks whether the user can access a specific API or not.
#### Signature
```typescript
function canAccess(api: any): bool;
```
#### Example
```typescript
import { AI, showHUD, environment } from "@raycast/api";
import fs from "fs";
export default async function main() {
if (environment.canAccess(AI)) {
const answer = await AI.ask("Suggest 5 jazz songs");
await Clipboard.copy(answer);
} else {
await showHUD("You don't have access :(");
}
}
```
#### Return
A Boolean indicating whether the user running the command has access to the API.
### getSelectedFinderItems
Gets the selected items from Finder.
#### Signature
```typescript
async function getSelectedFinderItems(): Promisestring
|
### LaunchType
Indicates the type of command launch. Use this to detect whether the command has been launched from the background.
#### Enumeration members
| Name | Description |
| :------------ | :--------------------------------------------------------- |
| UserInitiated | A regular launch through user interaction |
| Background | Scheduled through an interval and launched from background |
# Feedback
Raycast has several ways to provide feedback to the user:
- Toast _- when an asynchronous operation is happening or when an error is thrown_
- HUD _- to confirm an action worked after closing Raycast_
- Alert _- to ask for confirmation before taking an action_
# Alert
When the user takes an important action (for example when irreversibly deleting something), you can ask for confirmation by using `confirmAlert`.
## API Reference
### confirmAlert
Creates and shows a confirmation Alert with the given options.
#### Signature
```typescript
async function confirmAlert(options: Alert.Options): PromiseAlert.Options
|
#### Return
A Promise that resolves to a boolean when the user triggers one of the actions.
It will be `true` for the primary Action, `false` for the dismiss Action.
## Types
### Alert.Options
The options to create an Alert.
#### Example
```typescript
import { Alert, confirmAlert } from "@raycast/api";
export default async function Command() {
const options: Alert.Options = {
title: "Finished cooking",
message: "Delicious pasta for lunch",
primaryAction: {
title: "Do something",
onAction: () => {
// while you can register a handler for an action, it's more elegant
// to use the `if (await confirmAlert(...)) { ... }` pattern
console.log("The alert action has been triggered");
},
},
};
await confirmAlert(options);
}
```
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| title* | The title of an alert. Displayed below the icon. | string
|
| dismissAction | The Action to dismiss the alert. There usually shouldn't be any side effects when the user takes this action. | Alert.ActionOptions
|
| icon | The icon of an alert to illustrate the action. Displayed on the top. | Image.ImageLike
|
| message | An additional message for an Alert. Useful to show more information, e.g. a confirmation message for a destructive action. | string
|
| primaryAction | The primary Action the user can take. | Alert.ActionOptions
|
| rememberUserChoice | If set to true, the Alert will also display a `Do not show this message again` checkbox. When checked, the answer is persisted and directly returned to the extension the next time the alert should be shown, without the user actually seeing the alert. | boolean
|
### Alert.ActionOptions
The options to create an Alert Action.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| title* | The title of the action. | string
|
| onAction | A callback called when the action is triggered. | () => void
|
| style | The style of the action. | Alert.ActionStyle
|
### Alert.ActionStyle
Defines the visual style of an Action of the Alert.
Use Alert.ActionStyle.Default for confirmations of a positive action.
Use Alert.ActionStyle.Destructive.
#### Enumeration members
| Name | Value |
| :---------- | :------------------------------------------------------- |
| Default | |
| Destructive | |
| Cancel | |
# HUD
When the user takes an action that has the side effect of closing Raycast (for example when copying something in the Clipboard, you can use a HUD to confirm that the action worked properly.
## API Reference
### showHUD
A HUD will automatically hide the main window and show a compact message at the bottom of the screen.
#### Signature
```typescript
async function showHUD(
title: string,
options?: { clearRootSearch?: boolean; popToRootType?: PopToRootType }
): Promisestring
|
| options | Can be used to control the behaviour after closing the main window. | Object
|
| options.clearRootSearch | Clears the text in the root search bar and scrolls to the top | boolean
|
| options.popToRootType | Defines the pop to root behavior (PopToRootType); the default is to to respect the user's "Pop to Root Search" preference in Raycast | PopToRootType
|
#### Return
A Promise that resolves when the HUD is shown.
# Toast
When an asynchronous operation is happening or when an error is thrown, it's usually a good idea to keep the user informed about it. Toasts are made for that.
Additionally, Toasts can have some actions associated to the action they are about. For example, you could provide a way to cancel an asynchronous operation, undo an action, or copy the stack trace of an error.
{% hint style="info" %}
The `showToast()` will fallback to showHUD() if the Raycast window is closed.
{% endhint %}
## API Reference
### showToast
Creates and shows a Toast with the given options.
#### Signature
```typescript
async function showToast(options: Toast.Options): PromiseAlert.Options
|
#### Return
A Promise that resolves with the shown Toast. The Toast can be used to change or hide it.
## Types
### Toast
A Toast with a certain style, title, and message.
Use showToast to create and show a Toast.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| message* | An additional message for the Toast. Useful to show more information, e.g. an identifier of a newly created asset. | string
|
| primaryAction* | The primary Action the user can take when hovering on the Toast. | Alert.ActionOptions
|
| secondaryAction* | The secondary Action the user can take when hovering on the Toast. | Alert.ActionOptions
|
| style* | The style of a Toast. | Action.Style
|
| title* | The title of a Toast. Displayed on the top. | string
|
#### Methods
| Name | Type | Description |
| :--- | :---------------------------------- | :--------------- |
| hide | () => Promise<void>
| Hides the Toast. |
| show | () => Promise<void>
| Shows the Toast. |
### Toast.Options
The options to create a Toast.
#### Example
```typescript
import { showToast, Toast } from "@raycast/api";
export default async function Command() {
const options: Toast.Options = {
style: Toast.Style.Success,
title: "Finished cooking",
message: "Delicious pasta for lunch",
primaryAction: {
title: "Do something",
onAction: (toast) => {
console.log("The toast action has been triggered");
toast.hide();
},
},
};
await showToast(options);
}
```
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| title* | The title of a Toast. Displayed on the top. | string
|
| message | An additional message for the Toast. Useful to show more information, e.g. an identifier of a newly created asset. | string
|
| primaryAction | The primary Action the user can take when hovering on the Toast. | Alert.ActionOptions
|
| secondaryAction | The secondary Action the user can take when hovering on the Toast. | Alert.ActionOptions
|
| style | The style of a Toast. | Action.Style
|
### Toast.Style
Defines the visual style of the Toast.
Use Toast.Style.Success for displaying errors.
Use Toast.Style.Animated when your Toast should be shown until a process is completed.
You can hide it later by using Toast.hide or update the properties of an existing Toast.
#### Enumeration members
| Name | Value |
| :------- | :--------------------------------------------- |
| Animated | |
| Success | |
| Failure | |
### Toast.ActionOptions
The options to create a Toast Action.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| onAction* | A callback called when the action is triggered. | (toast: Toast => void
|
| title* | The title of the action. | string
|
| shortcut | The keyboard shortcut for the action. | Keyboard.Shortcut
|
# Keyboard
The Keyboard APIs are useful to make your actions accessible via the keyboard shortcuts. Shortcuts help users to use your command without touching the mouse.
## Types
### Keyboard.Shortcut
A keyboard shortcut is defined by one or more modifier keys (command, control, etc.) and a single key equivalent (a character or special key).
See KeyModifier for supported values.
#### Example
```typescript
import { Action, ActionPanel, Detail, Keyboard } from "@raycast/api";
export default function Command() {
return (
Keyboard.KeyEquivalent
|
| modifiers* | The modifier keys of the keyboard shortcut. | Keyboard.KeyModifier[]
|
### Keyboard.Shortcut.Common
A collection of shortcuts that are commonly used throughout Raycast. Using them should help provide a more consistent experience and preserve muscle memory.
| Name | Shortcut |
| --------------- | --------- |
| Copy | ⌘ + ⇧ + C |
| CopyDeeplink | ⌘ + ⇧ + C |
| CopyName | ⌘ + ⇧ + . |
| CopyPath | ⌘ + ⇧ + , |
| Duplicate | ⌘ + D |
| Edit | ⌘ + E |
| MoveDown | ⌘ + ⇧ + ↓ |
| MoveUp | ⌘ + ⇧ + ↑ |
| New | ⌘ + N |
| Open | ⌘ + O |
| OpenWith | ⌘ + ⇧ + O |
| Pin | ⌘ + ⇧ + P |
| Refresh | ⌘ + R |
| Remove | ⌃ + X |
| RemoveAll | ⌃ + ⇧ + X |
| ToggleQuickLook | ⌘ + Y |
### Keyboard.KeyEquivalent
```typescript
KeyEquivalent: "a" |
"b" |
"c" |
"d" |
"e" |
"f" |
"g" |
"h" |
"i" |
"j" |
"k" |
"l" |
"m" |
"n" |
"o" |
"p" |
"q" |
"r" |
"s" |
"t" |
"u" |
"v" |
"w" |
"x" |
"y" |
"z" |
"0" |
"1" |
"2" |
"3" |
"4" |
"5" |
"6" |
"7" |
"8" |
"9" |
"." |
"," |
";" |
"=" |
"+" |
"-" |
"[" |
"]" |
"{" |
"}" |
"«" |
"»" |
"(" |
")" |
"/" |
"\\" |
"'" |
"`" |
"§" |
"^" |
"@" |
"$" |
"return" |
"delete" |
"deleteForward" |
"tab" |
"arrowUp" |
"arrowDown" |
"arrowLeft" |
"arrowRight" |
"pageUp" |
"pageDown" |
"home" |
"end" |
"space" |
"escape" |
"enter" |
"backspace";
```
KeyEquivalent of a Shortcut
### Keyboard.KeyModifier
```typescript
KeyModifier: "cmd" | "ctrl" | "opt" | "shift";
```
Modifier of a Shortcut
# Menu Bar Commands
The `MenuBarExtra` component can be used to create commands which populate the [extras](https://developer.apple.com/design/human-interface-guidelines/components/system-experiences/the-menu-bar#menu-bar-commands) section of macOS' menu bar.
## Getting Started
If you don't have an extension yet, follow the getting started guide and then return to this page.
Now that your extension is ready, let's open its `package.json` file and add a new entry to its `commands` array, ensuring its `mode` property is set to `menu-bar`. For this guide, let's add the following:
```JSON
{
"name": "github-pull-requests",
"title": "Pull Requests",
"subtitle": "GitHub",
"description": "See your GitHub pull requests at a glance",
"mode": "menu-bar"
},
```
{% hint style="info" %}
Check out the command properties entry in the manifest file documentation for more detailed information on each of those properties.
{% endhint %}
Create `github-pull-requests.tsx` in your extensions `src/` folder and add the following:
```typescript
import { MenuBarExtra } from "@raycast/api";
export default function Command() {
return (
React.ReactNode
| - |
| icon | The icon that is displayed in the menu bar. | Image.ImageLike
| - |
| isLoading | Indicates to Raycast that it should not unload the command, as it is still executing. If you set make use of `isLoading`, you need to make sure you set it to `false` at the end of the task you are executing (such as an API call), so Raycast can then unload the command. | boolean
| - |
| title | The string that is displayed in the menu bar. | string
| - |
| tooltip | A tooltip to display when the cursor hovers the item in the menu bar. | string
| - |
### MenuBarExtra.Item
An item in the MenuBarExtra.
#### Example
{% tabs %}
{% tab title="ItemWithTitle.tsx" %}
An item that only provides a `title` prop will be rendered as disabled. Use this to create section titles.
```typescript
import { Icon, MenuBarExtra } from "@raycast/api";
export default function Command() {
return (
string
| - |
| alternate | A MenuBarExtra.Item to be displayed when a user presses the ⌥ (opt) key. | ReactElement<MenuBarExtra.Item.Props>
| - |
| icon | An optional icon for this item. | Image.ImageLike
| - |
| onAction | An action handler called when the user clicks the item. | (event: MenuBarExtra.ActionEvent => void
| - |
| shortcut | A shortcut used to invoke this item when its parent menu is open. | Keyboard.Shortcut
| - |
| subtitle | The subtitle displayed for this item. | string
| - |
| tooltip | A tooltip to display when the cursor hovers the item. | string
| - |
### MenuBarExtra.Submenu
`MenuBarExtra.Submenu`s reveal their items when people interact with them. They're a good way to group items that naturally belong together, but keep in mind that submenus add complexity to your interface - so use them sparingly!
#### Example
{% tabs %}
{% tab title="Bookmarks.tsx" %}
```typescript
import { Icon, MenuBarExtra, open } from "@raycast/api";
export default function Command() {
return (
string
| - |
| children | `MenuBarExtra.Item`s, `MenuBarExtra.Submenu`s, `MenuBarExtra.Separator` or a mix of either. | React.ReactNode
| - |
| icon | An optional icon for this submenu. | Image.ImageLike
| - |
### MenuBarExtra.Section
An item to group related menu items. It has an optional title and a separator is added automatically between sections.
#### Example
```typescript
import { Icon, MenuBarExtra, open } from "@raycast/api";
const data = {
archivedBookmarks: [{ name: "Google Search", url: "www.google.com" }],
newBookmarks: [{ name: "Raycast", url: "www.raycast.com" }],
};
export default function Command() {
return (
React.ReactNode
| - |
| title | Title displayed above the section | string
| - |
## Types
### MenuBarExtra.ActionEvent
An interface describing Action events in callbacks.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| type* | A type of the action event * `left-click` is a left mouse click on the MenuBarExtra.Item or a Keyboard.Shortcut * `right-click` is a right mouse click on the MenuBarExtra.Item | "left-click"
or "right-click"
|
#### Example
```typescript
import { MenuBarExtra } from "@raycast/api";
export default function Command() {
return (
authorizationRequest(options: AuthorizationRequestOptions): Promise
|
| authorize(options: AuthorizationRequest \| AuthorizationOptions): Promise
|
| setTokens(options: TokenSetOptions \| TokenResponse): Promise
|
| getTokens(): Promise
|
| removeTokens(): Promise
|
### OAuth.PKCEClient#authorizationRequest
Creates an authorization request for the provided authorization endpoint, client ID, and scopes. You need to first create the authorization request before calling authorize.
The generated code challenge for the PKCE request uses the S256 method.
#### Signature
```typescript
authorizationRequest(options: AuthorizationRequestOptions): PromiseAuthorizationRequestOptions
| The options used to create the authorization request. |
#### Return
A promise for an AuthorizationRequest.
### OAuth.PKCEClient#authorize
Starts the authorization and shows the OAuth overlay in Raycast. As parameter you can either directly use the returned request from authorizationRequest. Eventually the URL will be used to open the authorization page of the provider in the web browser.
#### Signature
```typescript
authorize(options: AuthorizationRequest | AuthorizationOptions): PromiseAuthorizationRequest
| The options used to authorize. |
#### Return
A promise for an AuthorizationResponse, which contains the authorization code needed for the token exchange. The promise is resolved when the user was redirected back from the provider's authorization page to the Raycast extension.
### OAuth.PKCEClient#setTokens
Securely stores a TokenSet.
At a minimum, you need to set the `accessToken`, and typically you also set `refreshToken` and `isExpired`.
Raycast automatically shows a logout preference for the extension when a token set was saved.
If you want to make use of the convenience `isExpired()` method, the property `expiresIn` must be configured.
#### Signature
```typescript
setTokens(options: TokenSetOptions | TokenResponse): PromiseTokenSetOptions
| The options used to store the token set. |
#### Return
A promise that resolves when the token set has been stored.
### OAuth.PKCEClient#getTokens
Retrieves the stored TokenSet for the client. You can use this to initially check whether the authorization flow should be initiated or the user is already logged in and you might have to refresh the access token.
#### Signature
```typescript
getTokens(): Promisestring
|
| redirectMethod* | The redirect method for the OAuth flow. Make sure to set this to the correct method for the provider, see OAuth.RedirectMethod for more information. | OAuth.RedirectMethod
|
| description | An optional description, shown in the OAuth overlay. You can use this to customize the message for the end user, for example for handling scope changes or other migrations. Raycast shows a default message if this is not configured. | string
|
| providerIcon | An icon displayed in the OAuth overlay. Make sure to provide at least a size of 64x64 pixels. | Image.ImageLike
|
| providerId | An optional ID for associating the client with a provider. Only set this if you use multiple different clients in your extension. | string
|
### OAuth.RedirectMethod
Defines the supported redirect methods for the OAuth flow. You can choose between web and app-scheme redirect methods, depending on what the provider requires when setting up the OAuth app. For examples on what redirect URI you need to configure, see the docs for each method.
#### Enumeration members
| Name | Value |
| :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Web | Use this type for a redirect back to the Raycast website, which will then open the extension. In the OAuth app, configure `https://raycast.com/redirect?packageName=Extension`string
|
| endpoint* | The URL to the authorization endpoint for the OAuth provider. | string
|
| scope* | A space-delimited list of scopes for identifying the resources to access on the user's behalf. The scopes are typically shown to the user on the provider's consent screen in the browser. Note that some providers require the same scopes be configured in the registered OAuth app. | string
|
| extraParameters | Optional additional parameters for the authorization request. Note that some providers require additional parameters, for example to obtain long-lived refresh tokens. | { [string]: string }
|
### OAuth.AuthorizationRequestURLParams
Values of AuthorizationRequest.
The PKCE client automatically generates the values for you and returns them for authorizationRequest
| Property | Description | Type |
| :--- | :--- | :--- |
| codeChallenge* | The PKCE `code_challenge` value. | string
|
| codeVerifier* | The PKCE `code_verifier` value. | string
|
| redirectURI* | The OAuth `redirect_uri` value. | string
|
| state* | The OAuth `state` value. | string
|
### OAuth.AuthorizationRequest
The request returned by authorizationRequest.
Can be used as direct input to authorize.
| Property | Description | Type |
| :--- | :--- | :--- |
| codeChallenge* | The PKCE `code_challenge` value. | string
|
| codeVerifier* | The PKCE `code_verifier` value. | string
|
| redirectURI* | The OAuth `redirect_uri` value. | string
|
| state* | The OAuth `state` value. | string
|
| toURL* | | () => string
|
#### Methods
| Name | Type | Description |
| :------ | :------------------------ | :------------------------------------- |
| toURL() | () => string
| Constructs the full authorization URL. |
### OAuth.AuthorizationOptions
Options for customizing authorize.
You can use values from AuthorizationRequest to build your own URL.
| Property | Description | Type |
| :--- | :--- | :--- |
| url* | The full authorization URL. | string
|
### OAuth.AuthorizationResponse
The response returned by authorize, containing the authorization code after the provider redirect. You can then exchange the authorization code for an access token using the provider's token endpoint.
| Property | Description | Type |
| :--- | :--- | :--- |
| authorizationCode* | The authorization code from the OAuth provider. | string
|
### OAuth.TokenSet
Describes the TokenSet created from an OAuth provider's token response. The `accessToken` is the only required parameter but typically OAuth providers also return a refresh token, an expires value, and the scope.
Securely store a token set via setTokens.
| Property | Description | Type |
| :--- | :--- | :--- |
| accessToken* | The access token returned by an OAuth token request. | string
|
| updatedAt* | The date when the token set was stored via OAuth.PKCEClient.setTokens. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
|
| isExpired* | | () => boolean
|
| expiresIn | An optional expires value (in seconds) returned by an OAuth token request. | number
|
| idToken | An optional id token returned by an identity request (e.g. /me, Open ID Connect). | string
|
| refreshToken | An optional refresh token returned by an OAuth token request. | string
|
| scope | The optional space-delimited list of scopes returned by an OAuth token request. You can use this to compare the currently stored access scopes against new access scopes the extension might require in a future version, and then ask the user to re-authorize with new scopes. | string
|
#### Methods
| Name | Type | Description |
| :---------- | :------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| isExpired() | () => boolean
| A convenience method for checking whether the access token has expired. The method factors in some seconds of "buffer", so it returns true a couple of seconds before the actual expiration time. This requires the `expiresIn` parameter to be set. |
### OAuth.TokenSetOptions
Options for a TokenSet.
| Property | Description | Type |
| :--- | :--- | :--- |
| accessToken* | The access token returned by an OAuth token request. | string
|
| expiresIn | An optional expires value (in seconds) returned by an OAuth token request. | number
|
| idToken | An optional id token returned by an identity request (e.g. /me, Open ID Connect). | string
|
| refreshToken | An optional refresh token returned by an OAuth token request. | string
|
| scope | The optional scope value returned by an OAuth token request. | string
|
### OAuth.TokenResponse
Defines the standard JSON response for an OAuth token request.
The response can be directly used to store a TokenSet.
| Property | Description | Type |
| :--- | :--- | :--- |
| access_token* | The `access_token` value returned by an OAuth token request. | string
|
| expires_in | An optional `expires_in` value (in seconds) returned by an OAuth token request. | number
|
| id_token | An optional `id_token` value returned by an identity request (e.g. /me, Open ID Connect). | string
|
| refresh_token | An optional `refresh_token` value returned by an OAuth token request. | string
|
| scope | The optional `scope` value returned by an OAuth token request. | string
|
# Preferences
Use the Preferences API to make your extension configurable.
Preferences are configured in the manifest per command or shared in the context of an extension.
Required preferences need to be set by the user before a command opens. They are a great way to make sure that the user of your extension has everything set up properly.
## API Reference
### getPreferenceValues
A function to access the preference values that have been passed to the command.
Each preference name is mapped to its value, and the defined default values are used as fallback values.
#### Signature
```typescript
function getPreferenceValues(): { [preferenceName: string]: any };
```
#### Example
```typescript
import { getPreferenceValues } from "@raycast/api";
interface Preferences {
name: string;
bodyWeight?: string;
bodyHeight?: string;
}
export default async function Command() {
const preferences = getPreferenceValuestextfield
| string
|
| password
| string
|
| checkbox
| boolean
|
| dropdown
| string
|
| appPicker
| Application
|
| file
| string
|
| directory
| string
|
### openExtensionPreferences
Opens the extension's preferences screen.
#### Signature
```typescript
export declare function openExtensionPreferences(): Promisetextfield
| string
|
| password
| string
|
| checkbox
| boolean
|
| dropdown
| string
|
| appPicker
| Application
|
| file
| string
|
| directory
| string
|
{% hint style="info" %}
Raycast provides a global TypeScript namespace called `Preferences` which contains the types of the preferences of all the commands of the extension.
For example, if a command named `show-todos` has some preferences, its `getPreferenceValues`'s return type can be specified with `getPreferenceValuesstring
|
#### Return
A Promise that resolves with the stored value for the given key. If the key does not exist, `undefined` is returned.
### LocalStorage.setItem
Stores a value for the given key.
#### Signature
```typescript
async function setItem(key: string, value: Value): Promisestring
|
| value* | The value you want to create or update for the given key. | LocalStorage.Value
|
#### Return
A Promise that resolves when the value is stored.
### LocalStorage.removeItem
Removes the stored value for the given key.
#### Signature
```typescript
async function removeItem(key: string): Promisestring
|
#### Return
A Promise that resolves when the value is removed.
### LocalStorage.allItems
Retrieve all stored values in the local storage of an extension.
#### Signature
```typescript
async function allItems(): Promiseany
| The local storage value of a given key. |
### LocalStorage.Value
```typescript
Value: string | number | boolean;
```
Supported storage value types.
#### Example
```typescript
import { LocalStorage } from "@raycast/api";
export default async function Command() {
// String
await LocalStorage.setItem("favorite-fruit", "cherry");
// Number
await LocalStorage.setItem("fruit-basket-count", 3);
// Boolean
await LocalStorage.setItem("fruit-eaten-today", true);
}
```
# Tool
Tools are a type of entry point for an extension. As opposed to a command, they don’t show up in the root search and the user can’t directly interact with them. Instead, they are functionalities that the AI can use to interact with an extension.
## Types
### Tool.Confirmation
A tool confirmation is used to ask the user to validate the side-effects of the tool.
{% hint style="info" %}
The tool confirmation is executed _before_ the actual tool is executed and receives the same input as the tool.
A confirmation returns an optional object that describes what the tool is about to do. It is important to be as clear as possible.
If the user confirms the action, the tool will be executed afterwards. If the user cancels the action, the tool will not be executed.
{% endhint %}
```ts
type ConfirmationActionPanel.Children
| - |
| title | The title displayed at the top of the panel | string
| - |
### ActionPanel.Section
A group of visually separated items.
Use sections when the ActionPanel contains a lot of actions to help guide the user to related actions.
For example, create a section for all copy actions.
#### Example
```typescript
import { ActionPanel, Action, List } from "@raycast/api";
export default function Command() {
return (
ActionPanel.Section.Children
| - |
| title | Title displayed above the section | string
| - |
### ActionPanel.Submenu
A very specific action that replaces the current ActionPanel with its children when selected.
This is handy when an action needs to select from a range of options. For example, to add a label to a GitHub pull request or an assignee to a todo.
#### Example
```typescript
import { Action, ActionPanel, Color, Icon, List } from "@raycast/api";
export default function Command() {
return (
string
| - |
| autoFocus | Indicates whether the ActionPanel.Submenu should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens. | boolean
| - |
| children | Items of the submenu. | ActionPanel.Submenu.Children
| - |
| filtering | Toggles Raycast filtering. When `true`, Raycast will use the query in the search bar to filter the items. When `false`, the extension needs to take care of the filtering. You can further define how native filtering orders sections by setting an object with a `keepSectionOrder` property: When `true`, ensures that Raycast filtering maintains the section order as defined in the extension. When `false`, filtering may change the section order depending on the ranking values of items. | boolean
or { keepSectionOrder: boolean }
| - |
| icon | The icon displayed for the submenu. | Image.ImageLike
| - |
| isLoading | Indicates whether a loading indicator should be shown or hidden next to the search bar | boolean
| - |
| onOpen | Callback that is triggered when the Submenu is opened. This callback can be used to fetch its content lazily: ```js function LazySubmenu() { const [content, setContent] = useState(null) return ( () => void
| - |
| onSearchTextChange | Callback triggered when the search bar text changes. | (text: string) => void
| - |
| shortcut | The keyboard shortcut for the submenu. | Keyboard.Shortcut
| - |
| throttle | Defines whether the `onSearchTextChange` handler will be triggered on every keyboard press or with a delay for throttling the events. Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests). | boolean
| - |
## Types
### ActionPanel.Children
```typescript
ActionPanel.Children: ActionPanel.Section | ActionPanel.Section[] | ActionPanel.Section.Children | null
```
Supported children for the ActionPanel component.
### ActionPanel.Section.Children
```typescript
ActionPanel.Section.Children: Action | Action[] | ReactElementstring
| - |
| autoFocus | Indicates whether the Action should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens. | boolean
| - |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onAction | Callback that is triggered when the Action is selected. | () => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| style | Defines the visual style of the Action. | Alert.ActionStyle
| - |
### Action.CopyToClipboard
Action that copies the content to the clipboard.
The main window is closed, and a HUD is shown after the content was copied to the clipboard.
#### Example
```typescript
import { ActionPanel, Action, Detail } from "@raycast/api";
export default function Command() {
return (
string
or number
or Clipboard.Content
| - |
| concealed | Indicates whether the content be treated as confidential. If `true`, it will not be recorded in the Clipboard History. | boolean
| - |
| icon | A optional icon displayed for the Action. | Image.ImageLike
| - |
| onCopy | Callback when the content was copied to clipboard. | (content: string \| number \| Clipboard.Content => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.Open
An action to open a file or folder with a specific application, just as if you had double-clicked the
file's icon.
The main window is closed after the file is opened.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
export default function Command() {
return (
string
| - |
| title* | The title for the Action. | string
| - |
| application | The application name to use for opening the file. | string
or Application
| - |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onOpen | Callback when the file or folder was opened. | (target: string) => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
### Action.OpenInBrowser
Action that opens a URL in the default browser.
The main window is closed after the URL is opened in the browser.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
export default function Command() {
return (
string
| - |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onOpen | Callback when the URL was opened in the browser. | (url: string) => void
| - |
| shortcut | The optional keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.OpenWith
Action that opens a file or URL with a specific application.
The action opens a sub-menu with all applications that can open the file or URL.
The main window is closed after the item is opened in the specified application.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
import { homedir } from "os";
const DESKTOP_DIR = `${homedir()}/Desktop`;
export default function Command() {
return (
string
| - |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onOpen | Callback when the file or folder was opened. | (path: string) => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | The title for the Action. | string
| - |
### Action.Paste
Action that pastes the content to the front-most applications.
The main window is closed after the content is pasted to the front-most application.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
export default function Command() {
return (
string
or number
or Clipboard.Content
| - |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onPaste | Callback when the content was pasted into the front-most application. | (content: string \| number \| Clipboard.Content => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.Push
Action that pushes a new view to the navigation stack.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
function Ping() {
return (
React.ReactNode
| - |
| title* | The title displayed for the Action. | string
| - |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onPop | Callback when the target view will be popped. | () => void
| - |
| onPush | Callback when the target view was pushed. | () => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
### Action.ShowInFinder
Action that shows a file or folder in the Finder.
The main window is closed after the file or folder is revealed in the Finder.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
import { homedir } from "os";
const DOWNLOADS_DIR = `${homedir()}/Downloads`;
export default function Command() {
return (
"fs".PathLike
| - |
| icon | A optional icon displayed for the Action. | Image.ImageLike
| - |
| onShow | Callback when the file or folder was shown in the Finder. | (path: "fs".PathLike) => void
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.SubmitForm
Action that adds a submit handler for capturing form values.
#### Example
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| icon | The icon displayed for the Action. | Image.ImageLike
| - |
| onSubmit | Callback when the Form was submitted. The handler receives a the values object containing the user input. | (input: Form.Values => boolean \| void \| Promise<boolean \| void>
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| style | Defines the visual style of the Action. | Alert.ActionStyle
| - |
| title | The title displayed for the Action. | string
| - |
### Action.Trash
Action that moves a file or folder to the Trash.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
import { homedir } from "os";
const FILE = `${homedir()}/Downloads/get-rid-of-me.txt`;
export default function Command() {
return (
"fs".PathLike
or "fs".PathLike[]
| - |
| icon | A optional icon displayed for the Action. | Image.ImageLike
| - |
| onTrash | Callback when all items were moved to the trash. | (paths: "fs".PathLike \| "fs".PathLike[]) => void
| - |
| shortcut | The optional keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.CreateSnippet
Action that navigates to the the Create Snippet command with some or all of the fields prefilled.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
export default function Command() {
return (
Snippet
| - |
| icon | A optional icon displayed for the Action. See Image.ImageLike for the supported formats and types. | Image.ImageLike
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.CreateQuicklink
Action that navigates to the the Create Quicklink command with some or all of the fields prefilled.
#### Example
```typescript
import { ActionPanel, Detail, Action } from "@raycast/api";
export default function Command() {
return (
Quicklink
| - |
| icon | A optional icon displayed for the Action. See Image.ImageLike for the supported formats and types. | Image.ImageLike
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | An optional title for the Action. | string
| - |
### Action.ToggleQuickLook
Action that toggles the Quick Look to preview a file.
#### Example
```typescript
import { ActionPanel, List, Action } from "@raycast/api";
export default function Command() {
return (
Image.ImageLike
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| title | The title for the Action. | string
| - |
### Action.PickDate
Action to pick a date.
#### Example
```typescript
import { ActionPanel, List, Action } from "@raycast/api";
export default function Command() {
return (
(date: [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)) => void
| - |
| title* | A title for the Action. | string
| - |
| icon | A optional icon displayed for the Action. | Image.ImageLike
| - |
| max | The maximum date (inclusive) allowed for selection. - If the PickDate type is `Type.Date`, only the full day date will be considered for comparison, ignoring the time components of the Date object. - If the PickDate type is `Type.DateTime`, both date and time components will be considered for comparison. The date should be a JavaScript Date object. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
| - |
| min | The minimum date (inclusive) allowed for selection. - If the PickDate type is `Type.Date`, only the full day date will be considered for comparison, ignoring the time components of the Date object. - If the PickDate type is `Type.DateTime`, both date and time components will be considered for comparison. The date should be a JavaScript Date object. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
| - |
| shortcut | The keyboard shortcut for the Action. | Keyboard.Shortcut
| - |
| type | Indicates what types of date components can be picked Defaults to Action.PickDate.Type.DateTime | Action.PickDate.Type
| - |
## Types
### Snippet
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| text* | The snippet contents. | string
|
| keyword | The keyword to trigger the snippet. | string
|
| name | The snippet name. | string
|
### Quicklink
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| link* | The URL or file path, optionally including placeholders such as in "https://google.com/search?q={Query}" | string
|
| application | The application that the quicklink should be opened in. | string
or Application
|
| icon | The icon to display for the quicklink. | Icon
|
| name | The quicklink name | string
|
### Action.Style
Defines the visual style of the Action.
Use Action.Style.Regular for displaying a regular actions.
Use Action.Style.Destructive when your action has something that user should be careful about.
Use the confirmation Alert if the action is doing something that user cannot revert.
### Action.PickDate.Type
The types of date components the user can pick with an `Action.PickDate`.
#### Enumeration members
| Name | Description |
| -------- | ---------------------------------------------------------------- |
| DateTime | Hour and second can be picked in addition to year, month and day |
| Date | Only year, month, and day can be picked |
### Action.PickDate.isFullDay
A method that determines if a given date represents a full day or a specific time.
```tsx
import { ActionPanel, List, Action } from "@raycast/api";
export default function Command() {
return (
string
|
| light* | The color which is used in light theme. | string
|
| adjustContrast | Enables dynamic contrast adjustment for light and dark theme color. | boolean
|
### Color.Raw
A color can also be a simple string. You can use any of the following color formats:
- HEX, e.g `#FF0000`
- Short HEX, e.g. `#F00`
- RGBA, e.g. `rgb(255, 0, 0)`
- RGBA Percentage, e.g. `rgb(255, 0, 0, 1.0)`
- HSL, e.g. `hsla(200, 20%, 33%, 0.2)`
- Keywords, e.g. `red`
# Detail
## API Reference
### Detail
Renders a markdown ([CommonMark](https://commonmark.org)) string with an optional metadata panel.
Typically used as a standalone view or when navigating from a List.
#### Example
{% tabs %}
{% tab title="Render a markdown string" %}
```typescript
import { Detail } from "@raycast/api";
export default function Command() {
return React.ReactNode
| - |
| isLoading | Indicates whether a loading bar should be shown or hidden below the search bar | boolean
| - |
| markdown | The CommonMark string to be rendered. | string
| - |
| metadata | The `Detail.Metadata` to be rendered in the right side area | React.ReactNode
| - |
| navigationTitle | The main title for that view displayed in Raycast | string
| - |
{% hint style="info" %}
You can specify custom image dimensions by adding a `raycast-width` and `raycast-height` query string to the markdown image. For example: `!Image Title`
You can also specify a tint color to apply to an markdown image by adding a `raycast-tint-color` query string. For example: `!Image Title`
{% endhint %}
{% hint style="info" %}
You can now render [LaTeX](https://www.latex-project.org) in the markdown. We support the following delimiters:
- Inline math: `\(...\)` and `\begin{math}...\end{math}`
- Display math: `\[...\]`, `$$...$$` and `\begin{equation}...\end{equation}`
{% endhint %}
### Detail.Metadata
A Metadata view that will be shown in the right-hand-side of the `Detail`.
Use it to display additional structured data about the main content shown in the `Detail` view.
#### Example
```typescript
import { Detail } from "@raycast/api";
// Define markdown here to prevent unwanted indentation.
const markdown = `
# Pikachu

Pikachu that can generate powerful electricity have cheek sacs that are extra soft and super stretchy.
`;
export default function Main() {
return (
React.ReactNode
| - |
### Detail.Metadata.Label
A single value with an optional icon.
#### Example
```typescript
import { Detail } from "@raycast/api";
// Define markdown here to prevent unwanted indentation.
const markdown = `
# Pikachu

Pikachu that can generate powerful electricity have cheek sacs that are extra soft and super stretchy.
`;
export default function Main() {
return (
string
| - |
| icon | An icon to illustrate the value of the item. | Image.ImageLike
| - |
| text | The text value of the item. Specifying `color` will display the text in the provided color. Defaults to Color.PrimaryText. | string
or { color?: Color; value: string }
| - |
### Detail.Metadata.Link
An item to display a link.
#### Example
```typescript
import { Detail } from "@raycast/api";
// Define markdown here to prevent unwanted indentation.
const markdown = `
# Pikachu

Pikachu that can generate powerful electricity have cheek sacs that are extra soft and super stretchy.
`;
export default function Main() {
return (
string
| - |
| text* | The text value of the item. | string
| - |
| title* | The title shown above the item. | string
| - |
### Detail.Metadata.TagList
A list of `Tags` displayed in a row.
#### Example
```typescript
import { Detail } from "@raycast/api";
// Define markdown here to prevent unwanted indentation.
const markdown = `
# Pikachu

Pikachu that can generate powerful electricity have cheek sacs that are extra soft and super stretchy.
`;
export default function Main() {
return (
React.ReactNode
| - |
| title* | The title shown above the item. | string
| - |
### Detail.Metadata.TagList.Item
A Tag in a `Detail.Metadata.TagList`.
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| color | Changes the text color to the provided color and sets a transparent background with the same color. | Color.ColorLike
| - |
| icon | The optional icon tag icon. Required if the tag has no text. | Image.ImageLike
| - |
| onAction | Callback that is triggered when the item is clicked. | () => void
| - |
| text | The optional tag text. Required if the tag has no icon. | string
| - |
### Detail.Metadata.Separator
A metadata item that shows a separator line. Use it for grouping and visually separating metadata items.
```typescript
import { Detail } from "@raycast/api";
// Define markdown here to prevent unwanted indentation.
const markdown = `
# Pikachu

Pikachu that can generate powerful electricity have cheek sacs that are extra soft and super stretchy.
`;
export default function Main() {
return (
React.ReactNode
| - |
| children | The Form.Item elements of the form. | React.ReactNode
| - |
| enableDrafts | Defines whether the Form.Items values will be preserved when user exits the screen. | boolean
| - |
| isLoading | Indicates whether a loading bar should be shown or hidden below the search bar | boolean
| - |
| navigationTitle | The main title for that view displayed in Raycast | string
| - |
| searchBarAccessory | Form.LinkAccessory that will be shown in the right-hand-side of the search bar. | ReactElement<Form.LinkAccessory.Props, string>
| - |
### Form.TextField
A form item with a text field for input.
#### Example
{% tabs %}
{% tab title="Uncontrolled text field" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled text field" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [name, setName] = useStatestring
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | string
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<string>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: string) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<string>) => void
| - |
| placeholder | Placeholder text shown in the text field. | string
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | string
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.PasswordField
A form item with a secure text field for password-entry in which the entered characters must be kept secret.
#### Example
{% tabs %}
{% tab title="Uncontrolled password field" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled password field" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [password, setPassword] = useStatestring
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | string
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<string>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: string) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<string>) => void
| - |
| placeholder | Placeholder text shown in the password field. | string
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | string
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.TextArea
A form item with a text area for input. The item supports multiline text entry.
#### Example
{% tabs %}
{% tab title="Uncontrolled text area" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
const DESCRIPTION =
"We spend too much time staring at loading indicators. The Raycast team is dedicated to make everybody interact faster with their computers.";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled text area" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [description, setDescription] = useStatestring
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | string
| - |
| enableMarkdown | Whether markdown will be highlighted in the TextArea or not. When enabled, markdown shortcuts starts to work for the TextArea (pressing `⌘ + B` will add `**bold**` around the selected text, `⌘ + I` will make the selected text italic, etc.) | boolean
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<string>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: string) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<string>) => void
| - |
| placeholder | Placeholder text shown in the text area. | string
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | string
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.Checkbox
A form item with a checkbox.
#### Example
{% tabs %}
{% tab title="Uncontrolled checkbox" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled checkbox" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [checked, setChecked] = useState(true);
return (
);
}
```
{% endtab %}
{% endtabs %}
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| id* | ID of the form item. Make sure to assign each form item a unique id. | string
| - |
| label* | The label displayed on the right side of the checkbox. | string
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | boolean
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<boolean>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: boolean) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<boolean>) => void
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | boolean
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.DatePicker
A form item with a date picker.
#### Example
{% tabs %}
{% tab title="Uncontrolled date picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled date picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [date, setDate] = useStatestring
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| max | The maximum date (inclusive) allowed for selection. - If the PickDate type is `Type.Date`, only the full day date will be considered for comparison, ignoring the time components of the Date object. - If the PickDate type is `Type.DateTime`, both date and time components will be considered for comparison. The date should be a JavaScript Date object. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
| - |
| min | The minimum date (inclusive) allowed for selection. - If the PickDate type is `Type.Date`, only the full day date will be considered for comparison, ignoring the time components of the Date object. - If the PickDate type is `Type.DateTime`, both date and time components will be considered for comparison. The date should be a JavaScript Date object. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)>) => void
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| type | Indicates what types of date components can be picked Defaults to Form.DatePicker.Type.DateTime | Form.DatePicker.Type
| - |
| value | The current value of the item. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
#### Form.DatePicker.isFullDay
A method that determines if a given date represents a full day or a specific time.
```ts
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
### Form.Dropdown
A form item with a dropdown menu.
#### Example
{% tabs %}
{% tab title="Uncontrolled dropdown" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled dropdown" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [programmingLanguage, setProgrammingLanguage] = useStatestring
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| children | Sections or items. If Form.Dropdown.Item elements are specified, a default section is automatically created. | React.ReactNode
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | string
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| filtering | Toggles Raycast filtering. When `true`, Raycast will use the query in the search bar to filter the items. When `false`, the extension needs to take care of the filtering. You can further define how native filtering orders sections by setting an object with a `keepSectionOrder` property: When `true`, ensures that Raycast filtering maintains the section order as defined in the extension. When `false`, filtering may change the section order depending on the ranking values of items. | boolean
or { keepSectionOrder: boolean }
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| isLoading | Indicates whether a loading indicator should be shown or hidden next to the search bar | boolean
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<string>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: string) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<string>) => void
| - |
| onSearchTextChange | Callback triggered when the search bar text changes. | (text: string) => void
| - |
| placeholder | Placeholder text that will be shown in the dropdown search field. | string
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| throttle | Defines whether the `onSearchTextChange` handler will be triggered on every keyboard press or with a delay for throttling the events. Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests). | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | string
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.Dropdown.Item
A dropdown item in a Form.Dropdown
#### Example
```typescript
import { Action, ActionPanel, Form, Icon } from "@raycast/api";
export default function Command() {
return (
);
}
```
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| title* | The title displayed for the item. | string
| - |
| value* | Value of the dropdown item. Make sure to assign each unique value for each item. | string
| - |
| icon | A optional icon displayed for the item. | Image.ImageLike
| - |
| keywords | An optional property used for providing additional indexable strings for search. When filtering the items in Raycast, the keywords will be searched in addition to the title. | string[]
| - |
### Form.Dropdown.Section
Visually separated group of dropdown items.
Use sections to group related menu items together.
#### Example
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| children | The item elements of the section. | React.ReactNode
| - |
| title | Title displayed above the section | string
| - |
### Form.TagPicker
A form item with a tag picker that allows the user to select multiple items.
#### Example
{% tabs %}
{% tab title="Uncontrolled tag picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled tag picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [countries, setCountries] = useStatestring
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| children | The list of tags. | React.ReactNode
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | string[]
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<string[]>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: string[]) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<string[]>) => void
| - |
| placeholder | Placeholder text shown in the token field. | string
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | string[]
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.TagPicker.Item
A tag picker item in a Form.TagPicker.
#### Example
```typescript
import { ActionPanel, Color, Form, Icon, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| title* | The display title of the tag. | string
| - |
| value* | Value of the tag. Make sure to assign unique value for each item. | string
| - |
| icon | An icon to show in the tag. | Image.ImageLike
| - |
### Form.Separator
A form item that shows a separator line. Use for grouping and visually separating form items.
#### Example
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
### Form.FilePicker
A form item with a button to open a dialog to pick some files and/or some directories (depending on its props).
{% hint style="info" %}
While the user picked some items that existed, it might be possible for them to be deleted or changed when the `onSubmit` callback is called. Hence you should always make sure that the items exist before acting on them!
{% endhint %}
#### Example
{% tabs %}
{% tab title="Uncontrolled file picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import fs from "fs";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Single selection file picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import fs from "fs";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Directory picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import fs from "fs";
export default function Command() {
return (
);
}
```
{% endtab %}
{% tab title="Controlled file picker" %}
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
import { useState } from "react";
export default function Command() {
const [files, setFiles] = useStatestring
| - |
| allowMultipleSelection | Indicates whether the user can select multiple items or only one. | boolean
| - |
| autoFocus | Indicates whether the item should be focused automatically once the form is rendered. | boolean
| - |
| canChooseDirectories | Indicates whether it's possible to choose a directory. | boolean
| - |
| canChooseFiles | Indicates whether it's possible to choose a file. | boolean
| - |
| defaultValue | The default value of the item. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. If you're using `storeValue` and configured it as `true` then the stored value will be set. If you configure `value` at the same time with `defaultValue`, the `value` will be set instead of `defaultValue`. | string[]
| - |
| error | An optional error message to show the form item validation issues. If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right. | string
| - |
| info | An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown. | string
| - |
| onBlur | The callback that will be triggered when the item loses its focus. | (event: FormEvent<string[]>) => void
| - |
| onChange | The callback which will be triggered when the `value` of the item changes. | (newValue: string[]) => void
| - |
| onFocus | The callback which will be triggered should be called when the item is focused. | (event: FormEvent<string[]>) => void
| - |
| showHiddenFiles | Indicates whether the file picker displays files that are normally hidden from the user. | boolean
| - |
| storeValue | Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered. | boolean
| - |
| title | The title displayed on the left side of the item. | string
| - |
| value | The current value of the item. | string[]
| - |
#### Methods (Imperative API)
| Name | Signature | Description |
| ----- | ----------------------- | -------------------------------------------------------------------------- |
| focus | () => void
| Makes the item request focus. |
| reset | () => void
| Resets the form item to its initial value, or `defaultValue` if specified. |
### Form.Description
A form item with a simple text label.
Do _not_ use this component to show validation messages for other form fields.
#### Example
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
);
}
```
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| text* | Text that will be displayed in the middle. | string
| - |
| title | The display title of the left side from the description item. | string
| - |
### Form.LinkAccessory
A link that will be shown in the right-hand side of the navigation bar.
#### Example
```typescript
import { ActionPanel, Form, Action } from "@raycast/api";
export default function Command() {
return (
}
actions={
string
| - |
| text* | The text value of the item. | string
| - |
## Types
#### Form.Event
Some Form.Item callbacks (like `onFocus` and `onBlur`) can return a `Form.Event` object that you can use in a different ways.
| Property | Description | Type |
| :--- | :--- | :--- |
| target* | An interface containing target data related to the event | { id: string; value?: any }
|
| type* | A type of event | Form.Event.Type
|
#### Example
```typescript
import { Form } from "@raycast/api";
export default function Main() {
return (
React.ReactNode
| - |
| aspectRatio | Aspect ratio for the Grid.Item elements. Defaults to 1. | "1"
or "3/2"
or "2/3"
or "4/3"
or "3/4"
or "16/9"
or "9/16"
| - |
| children | Grid sections or items. If Grid.Item elements are specified, a default section is automatically created. | React.ReactNode
| - |
| columns | Column count for the grid's sections. Minimum value is 1, maximum value is 8. | number
| - |
| filtering | Toggles Raycast filtering. When `true`, Raycast will use the query in the search bar to filter the items. When `false`, the extension needs to take care of the filtering. You can further define how native filtering orders sections by setting an object with a `keepSectionOrder` property: When `true`, ensures that Raycast filtering maintains the section order as defined in the extension. When `false`, filtering may change the section order depending on the ranking values of items. | boolean
or { keepSectionOrder: boolean }
| - |
| fit | Fit for the Grid.Item element content. Defaults to "contain" | Grid.Fit
| - |
| inset | Indicates how much space there should be between a Grid.Items' content and its borders. The absolute value depends on the value of the `itemSize` prop. | Grid.Inset
| - |
| isLoading | Indicates whether a loading bar should be shown or hidden below the search bar | boolean
| - |
| navigationTitle | The main title for that view displayed in Raycast | string
| - |
| onSearchTextChange | Callback triggered when the search bar text changes. | (text: string) => void
| - |
| onSelectionChange | Callback triggered when the item selection in the grid changes. When the received id is `null`, it means that all items have been filtered out and that there are no item selected | (id: string) => void
| - |
| pagination | Configuration for pagination | { hasMore: boolean; onLoadMore: () => void; pageSize: number }
| - |
| searchBarAccessory | Grid.Dropdown that will be shown in the right-hand-side of the search bar. | ReactElement<List.Dropdown.Props, string>
| - |
| searchBarPlaceholder | Placeholder text that will be shown in the search bar. | string
| - |
| searchText | The text that will be displayed in the search bar. | string
| - |
| selectedItemId | Selects the item with the specified id. | string
| - |
| throttle | Defines whether the `onSearchTextChange` handler will be triggered on every keyboard press or with a delay for throttling the events. Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests). | boolean
| - |
### Grid.Dropdown
A dropdown menu that will be shown in the right-hand-side of the search bar.
#### Example
```typescript
import { Grid, Image } from "@raycast/api";
import { useState } from "react";
const types = [
{ id: 1, name: "Smileys", value: "smileys" },
{ id: 2, name: "Animals & Nature", value: "animals-and-nature" },
];
const items: { [key: string]: { content: Image.ImageLike; keywords: string[] }[] } = {
smileys: [{ content: "🥳", keywords: ["partying", "face"] }],
"animals-and-nature": [{ content: "🙈", keywords: ["see-no-evil", "monkey"] }],
};
export default function Command() {
const [type, setType] = useStatestring
| - |
| children | Dropdown sections or items. If Dropdown.Item elements are specified, a default section is automatically created. | React.ReactNode
| - |
| defaultValue | The default value of the dropdown. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. **If you're using `storeValue` and configured it as `true` _and_ a Dropdown.Item with the same value exists, then it will be selected.** **If you configure `value` at the same time as `defaultValue`, the `value` will have precedence over `defaultValue`.** | string
| - |
| filtering | Toggles Raycast filtering. When `true`, Raycast will use the query in the search bar to filter the items. When `false`, the extension needs to take care of the filtering. You can further define how native filtering orders sections by setting an object with a `keepSectionOrder` property: When `true`, ensures that Raycast filtering maintains the section order as defined in the extension. When `false`, filtering may change the section order depending on the ranking values of items. | boolean
or { keepSectionOrder: boolean }
| - |
| id | ID of the dropdown. | string
| - |
| isLoading | Indicates whether a loading indicator should be shown or hidden next to the search bar | boolean
| - |
| onChange | Callback triggered when the dropdown selection changes. | (newValue: string) => void
| - |
| onSearchTextChange | Callback triggered when the search bar text changes. | (text: string) => void
| - |
| placeholder | Placeholder text that will be shown in the dropdown search field. | string
| - |
| storeValue | Indicates whether the value of the dropdown should be persisted after selection, and restored next time the dropdown is rendered. | boolean
| - |
| throttle | Defines whether the `onSearchTextChange` handler will be triggered on every keyboard press or with a delay for throttling the events. Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests). | boolean
| - |
| value | The currently value of the dropdown. | string
| - |
### Grid.Dropdown.Item
A dropdown item in a Grid.Dropdown
#### Example
```typescript
import { Grid } from "@raycast/api";
export default function Command() {
return (
string
| - |
| value* | Value of the dropdown item. Make sure to assign each unique value for each item. | string
| - |
| icon | An optional icon displayed for the item. | Image.ImageLike
| - |
| keywords | An optional property used for providing additional indexable strings for search. When filtering the items in Raycast, the keywords will be searched in addition to the title. | string[]
| - |
### Grid.Dropdown.Section
Visually separated group of dropdown items.
Use sections to group related menu items together.
#### Example
```typescript
import { Grid } from "@raycast/api";
export default function Command() {
return (
React.ReactNode
| - |
| title | Title displayed above the section | string
| - |
### Grid.EmptyView
A view to display when there aren't any items available. Use to greet users with a friendly message if the
extension requires user input before it can show any items e.g. when searching for an image, a gif etc.
Raycast provides a default `EmptyView` that will be displayed if the Grid component either has no children,
or if it has children, but none of them match the query in the search bar. This too can be overridden by passing an
empty view alongside the other `Grid.Item`s.
Note that the `EmptyView` is _never_ displayed if the `Grid`'s `isLoading` property is true and the search bar is empty.
#### Example
```typescript
import { useEffect, useState } from "react";
import { Grid, Image } from "@raycast/api";
export default function CommandWithCustomEmptyView() {
const [state, setState] = useState<{
searchText: string;
items: { content: Image.ImageLike; title: string }[];
}>({ searchText: "", items: [] });
useEffect(() => {
console.log("Running effect after state.searchText changed. Current value:", JSON.stringify(state.searchText));
// perform an API call that eventually populates `items`.
}, [state.searchText]);
return (
React.ReactNode
| - |
| description | An optional description for why the empty view is shown. | string
| - |
| icon | An icon displayed in the center of the EmptyView. | Image.ImageLike
| - |
| title | The main title displayed for the Empty View. | string
| - |
### Grid.Item
A item in the Grid.
This is one of the foundational UI components of Raycast. A grid item represents a single entity. It can be an image, an emoji, a GIF etc. You most likely want to perform actions on this item, so make it clear
to the user what this item is about.
#### Example
```typescript
import { Grid } from "@raycast/api";
export default function Command() {
return (
Image.ImageLike }
or { tooltip: string; value: Image.ImageLike
or { color: Color.ColorLike; } }
| - |
| accessory | An optional Grid.Item.Accessory item displayed underneath a Grid.Item. | Grid.Item.Accessory
| - |
| actions | An ActionPanel that will be updated for the selected grid item. | React.ReactNode
| - |
| id | ID of the item. This string is passed to the `onSelectionChange` handler of the Grid when the item is selected. Make sure to assign each item a unique ID or a UUID will be auto generated. | string
| - |
| keywords | An optional property used for providing additional indexable strings for search. When filtering the list in Raycast through the search bar, the keywords will be searched in addition to the title. | string[]
| - |
| quickLook | Optional information to preview files with Quick Look. Toggle the preview ith Action.ToggleQuickLook. | { name?: string; path: "fs".PathLike }
| - |
| subtitle | An optional subtitle displayed below the title. | string
| - |
| title | An optional title displayed below the content. | string
| - |
### Grid.Section
A group of related Grid.Item.
Sections are a great way to structure your grid. For example, you can group photos taken in the same place or in the same day. This way, the user can quickly access what is most relevant.
Sections can specify their own `columns`, `fit`, `aspectRatio` and `inset` props, separate from what is defined on the main Grid component.
#### Example
{% tabs %}
{% tab title="GridWithSection.tsx" %}
```typescript
import { Grid } from "@raycast/api";
export default function Command() {
return (
"1"
or "3/2"
or "2/3"
or "4/3"
or "3/4"
or "16/9"
or "9/16"
| - |
| children | The Grid.Item elements of the section. | React.ReactNode
| - |
| columns | Column count for the section. Minimum value is 1, maximum value is 8. | number
| - |
| fit | Fit for the Grid.Item element content. Defaults to "contain" | Grid.Fit
| - |
| inset | Inset for the Grid.Item element content. Defaults to "none". | Grid.Inset
| - |
| subtitle | An optional subtitle displayed next to the title of the section. | string
| - |
| title | Title displayed above the section. | string
| - |
## Types
### Grid.Item.Accessory
An interface describing an accessory view in a `Grid.Item`.
### Grid.Inset
An enum representing the amount of space there should be between a Grid Item's content and its borders. The absolute value depends on the value of Grid's `columns` prop.
#### Enumeration members
| Name | Description |
| ------ | ------------- |
| Small | Small insets |
| Medium | Medium insets |
| Large | Large insets |
### Grid.ItemSize (deprecated)
An enum representing the size of the Grid's child Grid.Items.
#### Enumeration members
| Name | Description |
| ------ | --------------------- |
| Small | Fits 8 items per row. |
| Medium | Fits 5 items per row. |
| Large | Fits 3 items per row. |
### Grid.Fit
An enum representing how Grid.Item's content should be fit.
#### Enumeration members
| Name | Description |
| ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Contain | The content will be contained within the grid cell, with vertical/horizontal bars if its aspect ratio differs from the cell's. |
| Fill | The content will be scaled proportionally so that it fill the entire cell; parts of the content could end up being cropped out. |
# Icons & Images
## API Reference
### Icon
List of built-in icons that can be used for actions or list items.
#### Example
```typescript
import { Icon, List } from "@raycast/api";
export default function Command() {
return (
AddPerson
Airplane
AirplaneFilled
AirplaneLanding
AirplaneTakeoff
Airpods
Alarm
AlarmRinging
AlignCentre
AlignLeft
AlignRight
AmericanFootball
Anchor
AppWindow
AppWindowGrid2x2
AppWindowGrid3x3
AppWindowList
AppWindowSidebarLeft
AppWindowSidebarRight
ArrowClockwise
ArrowCounterClockwise
ArrowDown
ArrowDownCircle
ArrowDownCircleFilled
ArrowLeft
ArrowLeftCircle
ArrowLeftCircleFilled
ArrowNe
ArrowRight
ArrowRightCircle
ArrowRightCircleFilled
ArrowUp
ArrowUpCircle
ArrowUpCircleFilled
ArrowsContract
ArrowsExpand
AtSymbol
BandAid
BankNote
BarChart
BarCode
BathTub
Battery
BatteryCharging
BatteryDisabled
Bell
BellDisabled
Bike
Binoculars
Bird
BlankDocument
Bluetooth
Boat
Bold
Bolt
BoltDisabled
Book
Bookmark
Box
Brush
Bubble
Bug
Building
BulletPoints
BullsEye
BullsEyeMissed
Buoy
Calculator
Calendar
Camera
Car
Cart
Cd
Center
Check
CheckCircle
CheckList
CheckRosette
Checkmark
ChessPiece
ChevronDown
ChevronDownSmall
ChevronLeft
ChevronLeftSmall
ChevronRight
ChevronRightSmall
ChevronUp
ChevronUpDown
ChevronUpSmall
Circle
CircleDisabled
CircleEllipsis
CircleFilled
CircleProgress
CircleProgress100
CircleProgress25
CircleProgress50
CircleProgress75
ClearFormatting
Clipboard
Clock
Cloud
CloudLightning
CloudRain
CloudSnow
CloudSun
Code
CodeBlock
Cog
Coin
Coins
CommandSymbol
Compass
ComputerChip
Contrast
CopyClipboard
CreditCard
CricketBall
Crop
Crown
Crypto
DeleteDocument
Desktop
Devices
Dna
Document
Dot
Download
Droplets
Duplicate
EditShape
Eject
Ellipsis
EllipsisVertical
Emoji
EmojiSad
Envelope
Eraser
ExclamationMark
Exclamationmark
Exclamationmark2
Exclamationmark3
Eye
EyeDisabled
EyeDropper
Female
FilmStrip
Filter
Finder
Fingerprint
Flag
Folder
Footprints
Forward
ForwardFilled
FountainTip
FullSignal
GameController
Gauge
Gear
Geopin
Germ
Gift
Glasses
Globe
Goal
Hammer
HardDrive
Hashtag
Heading
Headphones
Heart
HeartDisabled
Heartbeat
Highlight
Hourglass
House
Humidity
Image
Important
Info
Italics
Key
Keyboard
Layers
Leaderboard
Leaf
LevelMeter
LightBulb
LightBulbOff
LineChart
Link
List
Livestream
LivestreamDisabled
Lock
LockDisabled
LockUnlocked
Logout
Lorry
Lowercase
MagnifyingGlass
Male
Map
Mask
Maximize
MedicalSupport
Megaphone
MemoryChip
MemoryStick
Message
Microphone
MicrophoneDisabled
Minimize
Minus
MinusCircle
MinusCircleFilled
Mobile
Monitor
Moon
MoonDown
MoonUp
Moonrise
Mountain
Mouse
Move
Mug
MugSteam
Multiply
Music
Network
NewDocument
NewFolder
Paperclip
Paragraph
Patch
Pause
PauseFilled
Pencil
Person
PersonCircle
PersonLines
Phone
PhoneRinging
PieChart
Pill
Pin
PinDisabled
Play
PlayFilled
Plug
Plus
PlusCircle
PlusCircleFilled
PlusMinusDivideMultiply
PlusSquare
PlusTopRightSquare
Power
Print
QuestionMark
QuestionMarkCircle
QuotationMarks
QuoteBlock
Racket
Raindrop
RaycastLogoNeg
RaycastLogoPos
Receipt
Redo
RemovePerson
Repeat
Replace
ReplaceOne
Reply
Rewind
RewindFilled
Rocket
Rosette
RotateAntiClockwise
RotateClockwise
Rss
Ruler
SaveDocument
Shield
ShortParagraph
Shuffle
Sidebar
Signal0
Signal1
Signal2
Signal3
Snippets
Snowflake
SoccerBall
Speaker
SpeakerDown
SpeakerHigh
SpeakerLow
SpeakerOff
SpeakerOn
SpeakerUp
SpeechBubble
SpeechBubbleActive
SpeechBubbleImportant
SquareEllipsis
StackedBars1
StackedBars2
StackedBars3
StackedBars4
Star
StarCircle
StarDisabled
Stars
Stop
StopFilled
Stopwatch
Store
StrikeThrough
Sun
Sunrise
Swatch
Switch
Syringe
Tack
TackDisabled
Tag
Temperature
TennisBall
Terminal
Text
TextCursor
TextInput
TextSelection
ThumbsDown
ThumbsDownFilled
ThumbsUp
ThumbsUpFilled
Ticket
Torch
Train
Trash
Tray
Tree
Trophy
TwoPeople
Umbrella
Underline
Undo
Upload
Uppercase
Video
VideoDisabled
Wallet
Wand
Warning
Waveform
Weights
Wifi
WifiDisabled
Wind
Window
Windsock
WrenchScrewdriver
WristWatch
XMarkCircle
XMarkCircleFilled
XMarkCircleHalfDash
XMarkTopRightSquare
Xmark
Image.Source
|
| fallback | Image.Fallback image, in case `source` can't be loaded. | Image.Fallback
|
| mask | A Image.Mask to apply to the image. | Image.Mask
|
| tintColor | A Color.ColorLike to tint all the non-transparent pixels of the image. | Color.ColorLike
|
### FileIcon
An icon as it's used in the Finder.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Command() {
return (
string
|
### Image.ImageLike
```typescript
ImageLike: URL | Asset | Icon | FileIcon | Image;
```
Union type for the supported image types.
#### Example
```typescript
import { Icon, Image, List } from "@raycast/api";
export default function Command() {
return (
React.ReactNode
| - |
| children | List sections or items. If List.Item elements are specified, a default section is automatically created. | React.ReactNode
| - |
| filtering | Toggles Raycast filtering. When `true`, Raycast will use the query in the search bar to filter the items. When `false`, the extension needs to take care of the filtering. You can further define how native filtering orders sections by setting an object with a `keepSectionOrder` property: When `true`, ensures that Raycast filtering maintains the section order as defined in the extension. When `false`, filtering may change the section order depending on the ranking values of items. | boolean
or { keepSectionOrder: boolean }
| - |
| isLoading | Indicates whether a loading bar should be shown or hidden below the search bar | boolean
| - |
| isShowingDetail | Whether the List should have an area on the right side of the items to show additional details about the selected item. When true, it is recommended not to show any accessories on the `List.Item` and instead show the additional information in the `List.Item.Detail` view. | boolean
| - |
| navigationTitle | The main title for that view displayed in Raycast | string
| - |
| onSearchTextChange | Callback triggered when the search bar text changes. | (text: string) => void
| - |
| onSelectionChange | Callback triggered when the item selection in the list changes. When the received id is `null`, it means that all items have been filtered out and that there are no item selected | (id: string) => void
| - |
| pagination | Configuration for pagination | { hasMore: boolean; onLoadMore: () => void; pageSize: number }
| - |
| searchBarAccessory | List.Dropdown that will be shown in the right-hand-side of the search bar. | ReactElement<List.Dropdown.Props, string>
| - |
| searchBarPlaceholder | Placeholder text that will be shown in the search bar. | string
| - |
| searchText | The text that will be displayed in the search bar. | string
| - |
| selectedItemId | Selects the item with the specified id. | string
| - |
| throttle | Defines whether the `onSearchTextChange` handler will be triggered on every keyboard press or with a delay for throttling the events. Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests). | boolean
| - |
### List.Dropdown
A dropdown menu that will be shown in the right-hand-side of the search bar.
#### Example
```typescript
import { List } from "@raycast/api";
type DrinkType = { id: string; name: string };
function DrinkDropdown(props: { drinkTypes: DrinkType[]; onDrinkTypeChange: (newValue: string) => void }) {
const { drinkTypes, onDrinkTypeChange } = props;
return (
string
| - |
| children | Dropdown sections or items. If Dropdown.Item elements are specified, a default section is automatically created. | React.ReactNode
| - |
| defaultValue | The default value of the dropdown. Keep in mind that `defaultValue` will be configured once per component lifecycle. This means that if a user changes the value, `defaultValue` won't be configured on re-rendering. **If you're using `storeValue` and configured it as `true` _and_ a Dropdown.Item with the same value exists, then it will be selected.** **If you configure `value` at the same time as `defaultValue`, the `value` will have precedence over `defaultValue`.** | string
| - |
| filtering | Toggles Raycast filtering. When `true`, Raycast will use the query in the search bar to filter the items. When `false`, the extension needs to take care of the filtering. You can further define how native filtering orders sections by setting an object with a `keepSectionOrder` property: When `true`, ensures that Raycast filtering maintains the section order as defined in the extension. When `false`, filtering may change the section order depending on the ranking values of items. | boolean
or { keepSectionOrder: boolean }
| - |
| id | ID of the dropdown. | string
| - |
| isLoading | Indicates whether a loading indicator should be shown or hidden next to the search bar | boolean
| - |
| onChange | Callback triggered when the dropdown selection changes. | (newValue: string) => void
| - |
| onSearchTextChange | Callback triggered when the search bar text changes. | (text: string) => void
| - |
| placeholder | Placeholder text that will be shown in the dropdown search field. | string
| - |
| storeValue | Indicates whether the value of the dropdown should be persisted after selection, and restored next time the dropdown is rendered. | boolean
| - |
| throttle | Defines whether the `onSearchTextChange` handler will be triggered on every keyboard press or with a delay for throttling the events. Recommended to set to `true` when using custom filtering logic with asynchronous operations (e.g. network requests). | boolean
| - |
| value | The currently value of the dropdown. | string
| - |
### List.Dropdown.Item
A dropdown item in a List.Dropdown
#### Example
```typescript
import { List } from "@raycast/api";
export default function Command() {
return (
string
| - |
| value* | Value of the dropdown item. Make sure to assign each unique value for each item. | string
| - |
| icon | An optional icon displayed for the item. | Image.ImageLike
| - |
| keywords | An optional property used for providing additional indexable strings for search. When filtering the items in Raycast, the keywords will be searched in addition to the title. | string[]
| - |
### List.Dropdown.Section
Visually separated group of dropdown items.
Use sections to group related menu items together.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Command() {
return (
React.ReactNode
| - |
| title | Title displayed above the section | string
| - |
### List.EmptyView
A view to display when there aren't any items available. Use to greet users with a friendly message if the
extension requires user input before it can show any list items e.g. when searching for a package, an article etc.
Raycast provides a default `EmptyView` that will be displayed if the List component either has no children,
or if it has children, but none of them match the query in the search bar. This too can be overridden by passing an
empty view alongside the other `List.Item`s.
Note that the `EmptyView` is _never_ displayed if the `List`'s `isLoading` property is true and the search bar is empty.
#### Example
```typescript
import { useEffect, useState } from "react";
import { List } from "@raycast/api";
export default function CommandWithCustomEmptyView() {
const [state, setState] = useState({ searchText: "", items: [] });
useEffect(() => {
// perform an API call that eventually populates `items`.
}, [state.searchText]);
return (
React.ReactNode
| - |
| description | An optional description for why the empty view is shown. | string
| - |
| icon | An icon displayed in the center of the EmptyView. | Image.ImageLike
| - |
| title | The main title displayed for the Empty View. | string
| - |
### List.Item
A item in the List.
This is one of the foundational UI components of Raycast. A list item represents a single entity. It can be a
GitHub pull request, a file, or anything else. You most likely want to perform actions on this item, so make it clear
to the user what this list item is about.
#### Example
```typescript
import { Icon, List } from "@raycast/api";
export default function Command() {
return (
string
or { tooltip?: string; value: string }
| - |
| accessories | An optional array of List.Item.Accessory items displayed on the right side in a List.Item. | List.Item.Accessory[]
| - |
| actions | An ActionPanel that will be updated for the selected list item. | React.ReactNode
| - |
| detail | The `List.Item.Detail` to be rendered in the right side area when the parent List is showing details and the item is selected. | React.ReactNode
| - |
| icon | An optional icon displayed for the list item. | Image.ImageLike }
| - |
| id | ID of the item. This string is passed to the `onSelectionChange` handler of the List when the item is selected. Make sure to assign each item a unique ID or a UUID will be auto generated. | string
| - |
| keywords | An optional property used for providing additional indexable strings for search. When filtering the list in Raycast through the search bar, the keywords will be searched in addition to the title. | string[]
| - |
| quickLook | Optional information to preview files with Quick Look. Toggle the preview with Action.ToggleQuickLook. | { name?: string; path: "fs".PathLike }
| - |
| subtitle | An optional subtitle displayed next to the main title, optionally with a tooltip. | string
or { tooltip?: string; value?: string }
| - |
### List.Item.Detail
A Detail view that will be shown in the right-hand-side of the `List`.
When shown, it is recommended not to show any accessories on the `List.Item` and instead bring those additional information in the `List.Item.Detail` view.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Command() {
return (
boolean
| - |
| markdown | The CommonMark string to be rendered in the right side area when the parent List is showing details and the item is selected. | string
| - |
| metadata | The `List.Item.Detail.Metadata` to be rendered in the bottom side of the `List.Item.Detail` | React.ReactNode
| - |
### List.Item.Detail.Metadata
A Metadata view that will be shown in the bottom side of the `List.Item.Detail`.
Use it to display additional structured data about the content of the `List.Item`.
#### Example
{% tabs %}
{% tab title="Metadata + Markdown" %}
```typescript
import { List } from "@raycast/api";
export default function Metadata() {
const markdown = `

There is a plant seed on its back right from the day this Pokémon is born. The seed slowly grows larger.
`;
return (
React.ReactNode
| - |
### List.Item.Detail.Metadata.Label
A title with, optionally, an icon and/or text to its right.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Metadata() {
return (
string
| - |
| icon | An icon to illustrate the value of the item. | Image.ImageLike
| - |
| text | The text value of the item. Specifying `color` will display the text in the provided color. Defaults to Color.PrimaryText. | string
or { color?: Color; value: string }
| - |
### List.Item.Detail.Metadata.Link
An item to display a link.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Metadata() {
return (
string
| - |
| text* | The text value of the item. | string
| - |
| title* | The title shown above the item. | string
| - |
### List.Item.Detail.Metadata.TagList
A list of `Tags` displayed in a row.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Metadata() {
return (
React.ReactNode
| - |
| title* | The title shown above the item. | string
| - |
### List.Item.Detail.Metadata.TagList.Item
A Tag in a `List.Item.Detail.Metadata.TagList`.
#### Props
| Prop | Description | Type | Default |
| :--- | :--- | :--- | :--- |
| color | Changes the text color to the provided color and sets a transparent background with the same color. | Color.ColorLike
| - |
| icon | The optional icon tag icon. Required if the tag has no text. | Image.ImageLike
| - |
| onAction | Callback that is triggered when the item is clicked. | () => void
| - |
| text | The optional tag text. Required if the tag has no icon. | string
| - |
### List.Item.Detail.Metadata.Separator
A metadata item that shows a separator line. Use it for grouping and visually separating metadata items.
#### Example
```typescript
import { List } from "@raycast/api";
export default function Metadata() {
return (
React.ReactNode
| - |
| subtitle | An optional subtitle displayed next to the title of the section. | string
| - |
| title | Title displayed above the section. | string
| - |
## Types
### List.Item.Accessory
An interface describing an accessory view in a `List.Item`.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| tag* | A string or Date that will be used as the label, optionally colored. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.). Color changes the text color to the provided color and sets a transparent background with the same color. Defaults to Color.SecondaryText. | string
or [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
or undefined
or null
or { color?: Color.ColorLike
or undefined
or null }
|
| text | An optional text that will be used as the label, optionally colored. Color changes the text color to the provided color. Defaults to Color.SecondaryText. | string
or null
or { color?: Color; value: string
or undefined
or null }
|
| date | An optional Date that will be used as the label, optionally colored. The date is formatted relatively to the current time (for example `new Date()` will be displayed as `"now"`, yesterday's Date will be displayed as "1d", etc.). Color changes the text color to the provided color. Defaults to Color.SecondaryText. | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
or null
or { color?: Color
or undefined
or null }
|
| icon | An optional Image.ImageLike that will be used as the icon. | Image.ImageLike
or null
|
| tooltip | An optional tooltip shown when the accessory is hovered. | string
or null
|
#### Example
```typescript
import { Color, Icon, List } from "@raycast/api";
export default function Command() {
return (
() => void
|
| push* | Push a new view component to the navigation stack. | (component: React.ReactNode, onPop: () => void) => void
|
# System Utilities
This set of utilities exposes some of Raycast's native functionality to allow deep integration into the user's setup. For example, you can use the Application APIs to check if a desktop application is installed and then provide an action to deep-link into it.
## API Reference
### getApplications
Returns all applications that can open the file or URL.
#### Signature
```typescript
async function getApplications(path?: PathLike): Promise"fs".PathLike
|
#### Return
An array of Application.
### getDefaultApplication
Returns the default application that the file or URL would be opened with.
#### Signature
```typescript
async function getDefaultApplication(path: PathLike): Promise"fs".PathLike
|
#### Return
A Promise that resolves with the default Application that would open the file or URL. If no application was found, the promise will be rejected.
### getFrontmostApplication
Returns the frontmost application.
#### Signature
```typescript
async function getFrontmostApplication(): Promise"fs".PathLike
|
#### Return
A Promise that resolves when the item is revealed in the Finder.
### trash
Moves a file or directory to the Trash.
#### Signature
```typescript
async function trash(path: PathLike | PathLike[]): Promise"fs".PathLike
or "fs".PathLike[]
|
#### Return
A Promise that resolves when all files are moved to the trash.
### open
Opens a target with the default application or specified application.
#### Signature
```typescript
async function open(target: string, application?: Application | string): Promisestring
|
| application | The application name to use for opening the file. If no application is specified, the default application as determined by the system is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app. | string
or Application
|
#### Return
A Promise that resolves when the target has been opened.
### captureException
Report the provided exception to the Developer Hub.
This helps in handling failures gracefully while staying informed about the occurrence of the failure.
#### Signature
```typescript
function captureException(exception: unknown): void;
```
#### Example
```typescript
import { open, captureException, showToast, Toast } from "@raycast/api";
export default async function Command() {
const url = "https://www.raycast.com";
const app = "Google Chrome";
try {
await open(url, app);
} catch (e: unknown) {
captureException(e);
await showToast({
style: Toast.Style.Failure,
title: `Could not open ${url} in ${app}.`,
});
}
}
```
#### Parameters
| Name | Description | Type |
| :--- | :--- | :--- |
| target* | The file, folder or URL to open. | string
|
| application | The application name to use for opening the file. If no application is specified, the default application as determined by the system is used to open the specified file. Note that you can use the application name, app identifier, or absolute path to the app. | string
or Application
|
## Types
### Application
An object that represents a locally installed application on the system.
It can be used to open files or folders in a specific application. Use getApplications or
getDefaultApplication to get applications that can open a specific file or folder.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| name* | The display name of the application. | string
|
| path* | The absolute path to the application bundle, e.g. `/Applications/Raycast.app`, | string
|
| bundleId | The bundle identifier of the application, e.g. `com.raycast.macos`. | string
|
| localizedName | The localized name of the application. | string
|
### PathLike
```typescript
PathLike: string | Buffer | URL;
```
Supported path types.
# Raycast Window & Search Bar
## API Reference
### clearSearchBar
Clear the text in the search bar.
#### Signature
```typescript
async function clearSearchBar(options?: { forceScrollToTop?: boolean }): PromiseObject
|
| options.forceScrollToTop | Can be used to force scrolling to the top. Defaults to scrolling to the top after the the search bar was cleared. | boolean
|
#### Return
A Promise that resolves when the search bar is cleared.
### closeMainWindow
Closes the main Raycast window.
#### Signature
```typescript
async function closeMainWindow(options?: { clearRootSearch?: boolean; popToRootType?: PopToRootType }): PromiseObject
|
| options.clearRootSearch | Clears the text in the root search bar and scrolls to the top | boolean
|
| options.popToRootType | Defines the pop to root behavior (PopToRootType); the default is to to respect the user's "Pop to Root Search" preference in Raycast | PopToRootType
|
#### Return
A Promise that resolves when the main window is closed.
### popToRoot
Pops the navigation stack back to root search.
#### Signature
```typescript
async function popToRoot(options?: { clearSearchBar?: boolean }): PromiseObject
|
| options.clearSearchBar | | boolean
|
#### Return
A Promise that resolves when Raycast popped to root.
## Types
### PopToRootType
Defines the pop to root behavior when the main window is closed.
#### Enumeration members
| Name | Description |
| :-------- | :------------------------------------------------------------- |
| Default | Respects the user's "Pop to Root Search" preference in Raycast |
| Immediate | Immediately pops back to root |
| Suspended | Prevents Raycast from popping back to root |
# Window Management
The Window Management API provides developers with some functions to create commands with some advanced logic to move Windows around.
{% hint style="info" %}
Some users might not have access to this API. If a user doesn't have access to Raycast Pro, they will be asked if they want to get access when your extension calls the Window Management API. If the user doesn't wish to get access, the API call will throw an error.
You can check if a user has access to the API using `environment.canAccess(WindowManagement)`.
{% endhint %}
## API Reference
### WindowManagement.getActiveWindow
Gets the active Window.
#### Signature
```typescript
async function getActiveWindow(): Promise{ id: string }
or { bounds: { position?: { x?: number; y?: number }; size?: { height?: number; width?: number } }; desktopId?: string }
or { bounds: "fullscreen" }
|
#### Return
A Promise that resolves with the window was moved. If the move isn't possible (for example trying to make a window fullscreen that doesn't support it), the promise will be rejected.
## Types
### WindowManagement.Window
A Window from an Application.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| active* | | boolean
|
| bounds* | | { position: { x: number; y: number }; size: { height: number; width: number } }
or "fullscreen"
|
| desktopId* | | string
|
| fullScreenSettable* | | boolean
|
| id* | | string
|
| positionable* | | boolean
|
| resizable* | | boolean
|
| application | | Application
|
### WindowManagement.Desktop
A Desktop represents a virtual desktop on a Screen.
#### Properties
| Property | Description | Type |
| :--- | :--- | :--- |
| active* | | boolean
|
| id* | | string
|
| screenId* | | string
|
| size* | | { height: number; width: number }
|
| type* | | WindowManagement.DesktopType
|
### WindowManagement.DesktopType
The type of a Desktop.
#### Enumeration members
| Name | Description |
| :--------- | :---------------------------------------------------------------------------------------- |
| User | The default Desktop type. It can contain any number of Window |
| FullScreen | A Desktop made of a single fullscreen window |
# Contribute to an Extension
All published extensions are open-source and can be found in [this repository](https://github.com/raycast/extensions). This makes it easy for multiple developers to collaborate. This guide explains how to import an extension in order to fix a bug, add a new feature or otherwise contribute to it.
## Get source code
First, you need to find the source code of the extension. The easiest way to do this is to use the `Fork Extension` action in the Raycast's root search.
## Develop the extension
After you have the source code locally, open the Terminal and navigate to the extension's folder. Once there, run `npm install && npm run dev` from the extension folder in your Terminal to start developing the extension.
You should see your forked extension at the top of your root search and can open its commands.
When you're done editing the extension, make sure to add yourself to the contributors section of its manifest. If you used the `Fork Extension` action, this should have happened automatically.
Additionally, ensure the `CHANGELOG.md` file is updated with your changes; create it if it doesn't exist. Use the `{PR_MERGE_DATE}` placeholder for the date – see the Version History documentation for details.
Once everything is ready, see how to publish an extension.
# Create Your First Extension
## Create a new extension
Open the Create Extension command, name your extension "Hello World" and select the "Detail" template. Pick a parent folder in the Location field and press `⌘` `↵` to continue.
{% hint style="info" %}
To create a private extension, select your organization in the first dropdown. You need to be logged in and part of an organization to see the dropdown. Learn more about Raycast for Teams here.
{% endhint %}
{% hint style="info" %}
To kickstart your extensions, Raycast provides various templates for commands and tools. Learn more here.
{% endhint %}
Next, you'll need to follow the on-screen instructions to build the extension.
## Build the extension
Open your terminal, navigate to your extension directory and run `npm install && npm run dev`. Open Raycast, and you'll notice your extension at the top of the root search. Press `↵` to open it.
## Develop your extension
To make changes to your extension, open the `./src/index.tsx` file in your extension directory, change the `markdown` text and save it. Then, open your command in Raycast again and see your changes.
{% hint style="info" %}
`npm run dev` starts the extension in development mode with hot reloading, error reporting and more.
{% endhint %}
## Use your extension
Now, you can press `⌃` `C` in your terminal to stop `npm run dev`. The extension stays in Raycast, and you can find its commands in the root when searching for the extension name "Hello World" or the command name "Render Markdown".
🎉 Congratulations! You built your first extension. Off to many more.
{% hint style="info" %}
Don't forget to run `npm run dev` again when you want to change something in your extension.
{% endhint %}
# Debug an Extension
Bugs are unavoidable. Therefore it's important to have an easy way to discover and fix them. This guide shows you how to find problems in your extensions.
## Console
Use the `console` for simple debugging such as logging variables, function calls, or other helpful messages. All logs are shown in the terminal during development mode. Here are a few examples:
```typescript
console.log("Hello World"); // Prints: Hello World
const name = "Thomas";
console.debug(`Hello ${name}`); // Prints: Hello Thomas
const error = new Error("Boom 💥");
console.error(error); // Prints: Boom 💥
```
For more, checkout the [Node.js documentation](https://nodejs.org/dist/latest-v16.x/docs/api/console.html).
We automatically disable console logging for store extensions.
## Visual Studio Code
For more complex debugging you can install the [VSCode extension](https://marketplace.visualstudio.com/items?itemName=tonka3000.raycast) to be able to attach a node.js debugger to the running Raycast session.
1. Activate your extension in dev mode via `npm run dev` or via the VSCode command `Raycast: Start Development Mode`
2. Start the VSCode command `Raycast: Attach Debugger`
3. Set your breakpoint like in any other node.js base project
4. Activate your command
## Unhandled exceptions and Promise rejections
All unhandled exceptions and Promise rejections are shown with an error overlay in Raycast.
During development, we show the stack trace and add an action to jump to the error to make it easy to fix it. In production, only the error message is shown. You should show a toast for all expected errors, e.g. a failing network request.
### Extension Issue Dashboard
When unhandled exceptions and Promise rejections occur in the production build of a public extension, Raycast tries to redact all potentially sensitive information they may include, and reports them to our error backend. As an extension author, or as the manager of an organisation, you can view and manage error reports for your public extensions by going to https://www.raycast.com/extension-issues, or by finding your extension in Raycast's root, `Store` command, or `Manage Extensions` command, and using the `View Issues` action.
The dashboard should give you an overview of what issues occurred, how many times, how many users were affected, and more. Each issue additionally has a detail view, including a stack trace, breadcrumbs (typically the actions performed before the crash), extension release date, Raycast version, macOS version.
## React Developer Tools
We support [React Developer Tools](https://github.com/facebook/react/tree/main/packages/react-devtools) out-of-the-box. Use the tools to inspect and change the props of your React components, and see the results immediately in Raycast. This is especially useful for complex commands with a lot of states.
To get started, add the `react-devtools` to your extension. Open a terminal, navigate to your extension directory and run the following command:
```typescript
npm install --save-dev react-devtools@6.1.1
```
Then re-build your extension with `npm run dev`, open the command you want to debug in Raycast, and launch the React Developer Tools with `⌘` `⌥` `D`. Now select one of the React components, change a prop in the right sidebar, and hit enter. You'll notice the change immediately in Raycast.
### Alternative: Global installation of React Developer Tools
If you prefer to install the `react-devtools` globally, you can do the following:
```bash
npm install -g react-devtools@6.1.1
```
Then you can run `react-devtools` from a terminal to launch the standalone DevTools app. Raycast connects automatically, and you can start debugging your component tree.
## Environments
By default, extensions installed from the store run in Node production mode and development extensions in development mode. In development mode, the CLI output shows you additional errors and warnings (e.g. the infamous warning when you're missing the React `key` property for your list items); performance is generally better when running in production mode. You can force development extensions to run in Node production mode by going to Raycast Preferences > Advanced > "Use Node production environment".
At runtime, you can check which Node environment you're running in:
```typescript
if (process.env.NODE_ENV === "development") {
// running in development Node environment
}
```
To check whether you're running the store or local development version:
```typescript
import { environment } from "@raycast/api";
if (environment.isDevelopment) {
// running the development version
}
```
# Getting Started
## System Requirements
Before you can create your first extension, make sure you have the following prerequisites.
- You have Raycast 1.26.0 or higher installed.
- You have [Node.js](https://nodejs.org) 22.14 or higher installed. We recommend [nvm](https://github.com/nvm-sh/nvm) to install Node.
- You have [npm](http://npmjs.com) 7 or higher
- You are familiar with [React](https://reactjs.org) and [TypeScript](https://www.typescriptlang.org). Don't worry, you don't need to be an expert. If you need some help with the basics, check out TypeScript's [Handbook](https://www.typescriptlang.org/docs/handbook/intro.html) and React's [Getting Started](https://react.dev/learn) guide.
## Sign In
You need to be signed in to use the following extension development commands.
- **Store:** Search and install all published extensions
- **Create Extension:** Create new extensions from templates
- **Import Extension:** Import extensions from source code
- **Manage Extensions**: List and edit your published extensions
# Install an Extension
All published extensions are discoverable in the Raycast Store. Use the [web interface](https://raycast.com/store) or the Store command to find what you're looking for.
## In-app Store
The easiest way to discover extensions is the in-app store. Open the Store command in Raycast and search for an extension. Press `⌘` `↵` to install the selected extension or press `↵` to see more details about it.
## Web Store
Alternatively, you can use our [web store](https://raycast.com/store). Press `⌘` `K` to open the command palette, search for an extension and open it.
Then press the Install Extension button in the top right corner and follow the steps in Raycast.
## Use installed extensions
After an extension is installed, you can search for its commands in the root search. The extension can be further configured in the Extensions preferences tab.
# Prepare an Extension for Store
Here you will find requirements and guidelines that you'll need to follow in order to get through the review before your extension becomes available in the Store. Please read it carefully because it will save time for you and for us. This document is constantly evolving so please do visit it from time to time.
## Metadata and Configuration
- Things to double-check in your `package.json`
- Ensure you use your **Raycast** account username in the `author` field
- Ensure you use `MIT` in the `license` field
- Ensure you are using the latest Raycast API version
- Please use `npm` for installing dependencies and include `package-lock.json` in your pull request. We use `npm` on our Continuous Integration (CI) environment when building and publishing extensions so, by providing a `package-lock.json` file, we ensure that the dependencies on the server match the same versions as your local dependencies.
- Please check the terms of service of third-party services that your extension uses.
- Read the [Extension Guidelines](https://manual.raycast.com/extensions) and make sure that your Extension comply with it.
- Make sure to **run a distribution build** with `npm run build` locally before submitting the extension for review. This will perform additional type checking and create an optimized build. Open the extension in Raycast to check whether everything works as expected with the distribution build. In addition, you can perform linting and code style checks by running `npm run lint`. (Those checks will later also run via automated GitHub checks.)
## Extensions and Commands Naming
- Extension and command titles should follow [**Apple Style Guide**](https://help.apple.com/applestyleguide/#/apsgb744e4a3?sub=apdca93e113f1d64) convention
- ✅ `Google Workplace`, `Doppler Share Secrets`, `Search in Database`
- ❌ `Hacker news`, `my issues`
- 🤔 It's okay to use lower case for names and trademarks that are canonically written with lower case letters. E.g. `iOS` , `macOS` , `npm`.
- **Extension title**
- It will be used only in the Store and in the preferences
- Make it easy for people to understand what it does when they see it in the Store
- ✅ `Emoji Search`, `Airport - Discover Testflight Apps`, `Hacker News`
- ❌ `Converter`, `Images`, `Code Review`, `Utils`
- 🤔 In some cases, you can add additional information to the title similar to the Airport example above. Only do so if it adds context.
- 💡 You can use more creative titles to differentiate your extension from other extensions with similar names.
- Aim to use nouns rather than verbs
- `Emoji Search` is better than `Search Emoji`
- Avoid generic names for an extension when your extension doesn't provide a lot of commands
- E.g. if your extension can only search pages in Notion, name it `Notion Search` instead of just `Notion`. This will help users to form the right expectations about your extension. If your extension covers a lot of functionality, it's okay to use a generic name like `Notion`. Example: [GitLab](https://www.raycast.com/tonka3000/gitlab).
- **Rule of thumb:** If your extension has only one command, you probably need to name the extension close to what this command does. Example: [Visual Studio Code Recent Projects](https://www.raycast.com/thomas/visual-studio-code) instead of just `Visual Studio Code`.
- **Extension description**
- In one sentence, what does your extension do? This will be shown in the list of extensions in the Store. Keep it short and descriptive. See how other approved extensions in the Store do it for inspiration.
- **Command title**
- Usually it's `react-dom
?Arguments
|
| launchType* | The type of launch for the command (user initiated or background). | LaunchType
|
| draftValues | When a user enters the command via a draft, this object will contain the user inputs that were saved as a draft. Use its values to populate the initial state for your Form. | Form.Values
|
| fallbackText | When the command is launched as a fallback command, this string contains the text of the root search. | string
|
| launchContext | When the command is launched programmatically via `launchCommand`, this object contains the value passed to `context`. | LaunchContext
|
## Unloading
When the command is unloaded (typically by popping back to root search for view commands or after the script finishes for no-view commands), Raycast unloads the entire command from memory. Note that there are memory limits for commands, and if those limits are exceeded, the command gets terminated, and users will see an error message.
# Arguments
Raycast supports arguments for your commands so that users can enter values right from Root Search before opening the command.
Arguments are configured in the manifest per command.
{% hint style="info" %}
- **Maximum number of arguments:** 3 (if you have a use case that requires more, please let us know via feedback or in the [Slack community](https://www.raycast.com/community))
- The order of the arguments specified in the manifest is important and is reflected by the fields shown in Root Search. To provide a better UX, put the required arguments before the optional ones.
{% endhint %}
## Example
Let's say we want a command with three arguments. Its `package.json` will look like this:
```json
{
"name": "arguments",
"title": "API Arguments",
"description": "Example of Arguments usage in the API",
"icon": "command-icon.png",
"author": "raycast",
"license": "MIT",
"commands": [
{
"name": "my-command",
"title": "Arguments",
"subtitle": "API Examples",
"description": "Demonstrates usage of arguments",
"mode": "view",
"arguments": [
{
"name": "title",
"placeholder": "Title",
"type": "text",
"required": true
},
{
"name": "subtitle",
"placeholder": "Secret Subtitle",
"type": "password"
},
{
"name": "favoriteColor",
"type": "dropdown",
"placeholder": "Favorite Color",
"required": true,
"data": [
{
"title": "Red",
"value": "red"
},
{
"title": "Green",
"value": "green"
},
{
"title": "Blue",
"value": "blue"
}
]
}
]
}
],
"dependencies": {
"@raycast/api": "1.38.0"
},
"scripts": {
"dev": "ray develop",
"build": "ray build -e dist",
"lint": "ray lint"
}
}
```
The command itself will receive the arguments' values via the `arguments` prop:
```typescript
import { Form, LaunchProps } from "@raycast/api";
export default function Todoist(props: LaunchProps<{ arguments: Arguments.MyCommand }>) {
const { title, subtitle } = props.arguments;
console.log(`title: ${title}, subtitle: ${subtitle}`);
return (
text
| string
|
| password
| string
|
| dropdown
| string
|
{% hint style="info" %}
Raycast provides a global TypeScript namespace called `Arguments` which contains the types of the arguments of all the commands of the extension.
For example, if a command named `show-todos` accepts arguments, its `LaunchProps` can be described as `LaunchProps<{ arguments: Arguments.ShowTodos }>`. This will make sure that the types used in the command stay in sync with the manifest.
{% endhint %}
# Background Refresh
Commands of an extension can be configured to be automatically run in the background, without the user manually opening them.
Background refresh can be useful for:
- dynamically updating the subtitle of a command in Raycast root search
- refreshing menu bar commands
- other supporting functionality for your main commands
This guide helps you understand when and how to use background refresh and learn about the constraints.
## Scheduling Commands
Raycast supports scheduling commands with mode `no-view` and `menu-bar` at a configured interval.
### Manifest
Add a new property `interval` to a command in the manifest
Example:
```json
{
"name": "unread-notifications",
"title": "Show Unread Notifications",
"description": "Shows the number of unread notifications in root search",
"mode": "no-view",
"interval": "10m"
},
```
The interval specifies that the command should be launched in the background every X seconds (s), minutes (m), hours (h) or days (d). Examples: `10m`, `12h`, `1d`. The minimum value is 10 seconds (`10s`), which should be used cautiously, also see the section on best practices.
Note that the actual scheduling is not exact and might vary within a tolerance level. macOS determines the best time for running the command in order to optimize energy consumption, and scheduling times can also vary when running on battery. To prevent overlapping background launches of the same command, commands are terminated after a timeout that is dynamically adjusted to the interval.
## Running in the background
The entry point of your command stays the same when launched from the background. For no-view commands, a command will run until the Promise of the main async function resolves. Menu bar commands render a React component and run until the `isLoading` property is set to `false`.
You can use the global `environment.launchType` in your command to determine whether the command has been launched by the user (`LaunchType.UserInitiated`) or via background refresh (`LaunchType.Background`).
```typescript
import { environment, updateCommandMetadata } from "@raycast/api";
async function fetchUnreadNotificationCount() {
return 10;
}
export default async function Command() {
console.log("launchType", environment.launchType);
const count = await fetchUnreadNotificationCount();
await updateCommandMetadata({ subtitle: `Unread Notifications: ${count}` });
}
```
Raycast auto-terminates the command if it exceeds its maximum execution time. If your command saves some state that is shared with other commands, make sure to use defensive programming, i.e. add handling for errors and data races if the stored state is incomplete or inaccessible.
## Development and Debugging
For local commands under development, errors are shown as usual via the console. Two developer actions in root search help you to run and debug scheduled commands:
- Run in Background: this immediately runs the command with `environment.launchType` set to `LaunchType.Background`.
- Show Error: if the command could not be loaded or an uncaught runtime exception was thrown, the full error can be shown in the Raycast error overlay for development. This action is also shown to users of the installed Store command and provides actions to copy and report the error on the production error overlay.
When the background run leads to an error, users will also see a warning icon on the root search command and a tooltip with a hint to show the error via the Action Panel. The tooltip over the subtitle of a command shows the last run time.
You can launch the built-in root search command "Extension Diagnostics" to see which of your commands run in background and when they last ran.
## Preferences
For scheduled commands, Raycast automatically adds command preferences that give users the options to enable and disable background refresh. Preferences also show the last run time of the command.
When a user installs the command via the Store, background refresh is initially _disabled_ and is activated either when the user opens the command for the first time or enables background refresh in preferences. (This is to avoid automatically running commands in the background without the user being aware of it.)
## Best Practices
- Make sure the command is useful both when manually launched by the user or when launched in the background
- Choose the interval value as high as possible - low values mean the command will run more often and consume more energy
- If your command performs network requests, check the rate limits of the service and handle errors appropriately (e.g. automatically retry later)
- Make sure the command finishes as quickly as possible; for menu bar commands, ensure `isLoading` is set to false as early as possible
- Use defensive programming if state is shared between commands of an extension and handle potential data races and inaccessible data
# Deeplinks
Deeplinks are Raycast-specific URLs you can use to launch any command, as long as it's installed and enabled in Raycast.
They adhere to the following format:
```
raycast://extensions/An optional reference to an icon file in the assets folder. Use png format with a size of at least 512 x 512 pixels. To support light and dark theme, add two icons, one with @dark
as suffix, e.g. icon.png
and icon@dark.png
.
If no icon is specified, the extension icon will be used.
| | mode\* | A value of `view` indicates that the command will show a main view when performed. `no-view` means that the command does not push a view to the main navigation stack in Raycast. The latter is handy for directly opening a URL or other API functionalities that don't require a user interface. `menu-bar` indicates that this command will return a Menu Bar Extra | | interval | The value specifies that a `no-view` or `menu-bar` command should be launched in the background every X seconds (s), minutes (m), hours (h) or days (d). Examples: 90s, 1m, 12h, 1d. The minimum value is 1 minute (1m). | | keywords | An optional array of keywords for which the command can be searched in Raycast. | | arguments | An optional array of arguments that are requested from user when the command is called, see Argument properties. | | preferences | Commands can optionally contribute preferences that are shown in Raycast Preferences > Extensions when selecting the command. You can use preferences for configuration values and passwords or personal access tokens, see Preference properties. Commands automatically "inherit" extension preferences and can also override entries with the same `name`. | | disabledByDefault |Specify whether the command should be enabled by default or not. By default, all commands are enabled but there are some cases where you might want to include additional commands and let the user enable them if they need it.
Note that this flag is only used when installing a new extension or when there is a new command.
| ## Preference properties All properties for extension or command-specific preferences. Use the Preferences API to access their values. | Property | Description | | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | name\* | A unique id for the preference. | | title\* |The display name of the preference shown in Raycast preferences.
For `"checkbox"`, `"textfield"` and `"password"`, it is shown as a section title above the respective input element.
If you want to group multiple checkboxes into a single section, set the title
of the first checkbox and leave the title
of the other checkboxes empty.
An optional reference to an icon file in the assets folder. Use png format with a size of at least 512 x 512 pixels. To support light and dark theme, add two icons, one with @dark
as suffix, e.g. icon.png
and icon@dark.png
.
If no icon is specified, the extension icon will be used.
| #### AI Properties All properties for the AI capabilities of the extension. Alternatively, this object can be written in a `ai.json` (or `ai.yaml`) file at the root of the extension. | Property | Description | | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | instructions | A string containing additional instructions for the AI. It will be added as a system message whenever the extension is mentioned. It can for example be used to help the AI respond with a format that makes more sense for the extension: `Always format pull requests and issues as markdown links: [pull-request-title](https://github.com/:org/:repo/pull/:number) and [issue-title](https://github.com/:org/:repo/issues/:number)` | | evals | Evals for AI Extension. [More details](https://raycastapp.notion.site/AI-Extensions-Evals-15fd6e4a8215800598cad77d8afb5dc8?pvs=73) | # Security {% hint style="info" %} Note that this is _not_ a guide on how to create secure Raycast extensions but rather an overview of security-related aspects on how extensions are built, distributed and run. {% endhint %} ## Raycast Raycast itself runs outside of the App Store as "Developer ID Application", **signed** with the Raycast certificate and verified by Apple's **notarization service** before the app is distributed. Raycast provides various commands that interact with OS-level functionality, some of which prompt the user for granting **permissions** when required. The app is **automatically kept up-to-date** to minimize the risk of running heavily outdated versions and to ship hotfixes quickly. Raycast is a local-first application that stores user data in a local **encrypted database**, makes use of the system **Keychain** where secure data is stored, and generally connects to third-party APIs directly rather than proxying data through Raycast servers. ## Publishing Process All extensions are **open source** so the current source code can be inspected at all times. Before an extension gets merged into the **public repository**, members from Raycast and the community collaboratively **review** extensions, and follow our **store guidelines**. After the code review, the Continuous Integration system performs a set of **validations** to make sure that manifest conforms to the defined schema, required assets have the correct format, the author is valid, and no build and type errors are present. (More CI pipeline tooling for automated static security analysis is planned.) The built extension is then **archived and uploaded** to the Raycast Store, and eventually published for a registered user account. When an extension is installed or updated, the extension is downloaded from the store, unarchived to disk, and a record is updated in the local Raycast database. End-users install extensions through the built-in store or the web store. ## Runtime Model In order to run extensions, Raycast launches a **single child Node.js process** where extensions get loaded and unloaded as needed; inter-process communication with Raycast happens through standard file handles and a thin RPC protocol that only exposes a **defined set of APIs**, that is, an extension cannot just perform any Raycast operation. The **Node runtime is managed** by Raycast and automatically downloaded to the user's machine. We use an official version and **verify the Node binary** to ensure it has not been tampered with. An extension runs in its own **v8 isolate** (worker thread) and gets its own event loop, JavaScript engine and Node instance, and limited heap memory. That way, we ensure **isolation between extensions** when future Raycast versions may support background executions of multiple extensions running concurrently. ## Permissions Extensions are **not further sandboxed** as far as policies for file I/O, networking, or other features of the Node runtime are concerned; this might change in the future as we want to carefully balance user/developer experience and security needs. By default and similar to other macOS apps, accessing special directories such as the user Documents directory or performing screen recording first requires users to give **permissions** to Raycast (parent process) via the **macOS Security & Preferences** pane, otherwise programmatic access is not permitted. ## Data Storage While extensions can access the file system and use their own methods of storing and accessing data, Raycast provides **APIs for securely storing data**: _password_ preferences can be used to ask users for values such as access tokens, and the local storage APIs provide methods for reading and writing data payloads. In both cases, the data is stored in the local encrypted database and can only be accessed by the corresponding extension. ## Automatic Updates Both Raycast itself and extensions are **automatically updated** and we think of this as a security feature since countless exploits have happened due to outdated and vulnerable software. Our goal is that neither developers nor end-users need to worry about versions, and we **minimize the time from update to distribution** to end-users. # Terminology ## Action Actions are accessible via the Action Panel. They are little functionality to control something; for example, to add a label to the selected GitHub issue, copy the link to a Linear issue, or anything else. Actions can have assigned keyboard shortcuts. ## Action Panel Action Panel is located on the bottom right and can be opened with `⌘` `K`. It contains all currently available actions and makes them easily discoverable. ## AI Extensions AI Extensions are simply regular extensions. Once an extension has some tools, a user can `@mention` the extension in Quick AI, or the AI Commands, or the AI Chat. When doing so, the AI will have the opportunity to call one or multiple tools of the extensions mentioned. ## Command Commands are a type of entry point for an extension. Commands are available in the root search of Raycast. They can be a simple script or lists, forms, and more complex UI. ## Extension Extensions add functionality to Raycast. They consist of one or many commands and can be installed from the Store. ## Manifest Manifest is the `package.json` file of an extension. It's an npm package mixed with Raycast specific metadata. The latter is necessary to identify the package for Raycast and publish it to the Store. ## Tool Tools are a type of entry point for an extension. As opposed to a command, they don’t show up in the root search and the user can’t directly interact with them. Instead, they are functionalities that the AI can use to interact with an extension. # Versioning Versioning your extensions is straightforward since we've designed the system in a way that **frees you from having to deal with versioning schemes and compatibility**. The model is similar to that of app stores where there's only one implicit _latest_ version that will be updated when the extension is published in the store. Extensions are automatically updated for end users. ## Development For **development**, this means that you do _not_ declare a version property in the manifest. If you wish to use API features that were added in a later version, you just update your `@raycast/api` npm dependency, start using the feature, and submit an extension update to the store. ## End Users For **end-users** installing or updating your extension, Raycast automatically checks the compatibility between the API version that the extension actually uses and the user's current Raycast app version (which contains the API runtime and also manages the Node version). If there's a compatibility mismatch such as the user not having the required latest Raycast app version, we show a hint and prompt the user to update Raycast so that the next compatibility check succeeds. ## Version History Optionally, you can provide a `changelog.md` file in your extension, and give detailed changes with every update. These changes can be viewed by the user on the extension details screen, under Version History, as well as on the [raycast.com/store](https://raycast.com/store). You can learn more about Version History here, how to add it to your extension, and the required format for the best appearance. ## API Evolution Generally, we follow an **API evolution** process, meaning that we stay backward-compatible and do not introduce breaking changes within the same major API version. We'll 1) add new functionality and 2) we'll mark certain API methods and components as _deprecated_ over time, which signals to you that you should stop using those features and migrate to the new recommended alternatives. At some point in the future, we may introduce a new breaking major release; however, at this time, you will be notified, and there will be a transition period for migrating extensions. # Collaborate on Private Extensions Isn't it more fun to work with your colleagues together on your extension? For this, we recommend to share all your extensions in a single repository, similar to how we organize the [public store](https://raycast.com/store). If you follow the Getting Started guide, we will set up a local repository for you that is optimized for collaboration. As next steps, create a [new repository](https://github.com/new) and push the existing local repository. Afterwards, your teammates can check out the code and help you improve your extensions and add new ones. # Getting Started with Raycast for Teams Raycast for Teams allows you to build, share and discover extensions in a private store. The store is only accessible to members of your organization. ## Create Your Organization To get started, create your organization. Specify the name of the organization, a handle (used in links, e.g. `https://raycast.com/your_org/some_extension`) and optionally upload an avatar. {% hint style="info" %} You can use the Manage Organization command to edit your organization's information later. {% endhint %} ## Create Your Private Extension Store After you've created your organization, it's time to set up a private store for your extensions. ### Init a Local Repository First, select a folder to create a local repository for your private extension store. We create a folder that contains a Getting Started extension. We recommend to store all extensions of your team in a single repository. This makes it easy to collaborate. ### Build The Getting Started Extension After you have created the local repository, navigate into the `getting-started` folder. The folder contains a simple extension with a command that shows a list with a few useful links. Run `npm run dev` in the folder to build the extension and start development mode. Raycast opens and you can see a new Development section in the root search. The section shows all commands that are under active development. You can open the command and open a few links. {% hint style="info" %} See Create Your First Extension for a more detailed guide on how to create an extension. {% endhint %} ### Publish The Getting Started Extension Now, we share the extension with your organization. Perform `npm run publish` in the extension folder. The command verifies, builds and publishes the extension to your private extension store. The extension is only accessible to members of your organization. 🎉 Congratulations! You built and published your first private extension. Now it's time to spread the word in your organization. ## Invite Your Teammates Use the Copy Organization Invite Link command in Raycast to share access to your organization. Send the link to your teammates. You'll receive an email when somebody joins your organization. You can use the Manage Organization command to see who's part of your organization, reset the invite link and edit your organization details. As a next step, follow this guide to push your local repository to a source control system. This allows you to collaborate with your teammates on your extensions. # Publish a Private Extension To publish an extension, run `npm run publish` in the extension directory. The command verifies, builds and publishes the extension to the owner's store. The extension is only available to members of this organization. A link to your extension is copied to your clipboard to share it with your teammates. Happy publishing 🥳 To mark an extension as private, you need to set the `owner` field in your `package.json` to your organization handle. If you don't know your handle, open the Manage Organization command, select your organization in the dropdown on the top right and perform the Copy Organization Handle action (`⌘` `⇧` `.`). {% hint style="info" %} Use the Create Extension command to create a private extension for your organization. {% endhint %} To be able to publish a private extension to an organization, you need to be logged in. Raycast takes care of logging you in with the CLI as well. In case you aren't logged in or need to switch an account, you can run `npx ray login` and `npx ray logout`. # Functions # `createDeeplink` Function that creates a deeplink for an extension or script command. ## Signature There are three ways to use the function. The first one is for creating a deeplink to a command inside the current extension: ```ts function createDeeplink(options: { type?: DeeplinkType.Extension, command: string, launchType?: LaunchType, arguments?: LaunchProps["arguments"], fallbackText?: string, }): string; ``` The second one is for creating a deeplink to an extension that is not the current extension: ```ts function createDeeplink(options: { type?: DeeplinkType.Extension, ownerOrAuthorName: string, extensionName: string, command: string, launchType?: LaunchType, arguments?: LaunchProps["arguments"], fallbackText?: string, }): string; ``` The third one is for creating a deeplink to a script command: ```ts function createDeeplink(options: { type: DeeplinkType.ScriptCommand, command: string, arguments?: string[], }): string; ``` ### Arguments #### Extension - `type` is the type of the deeplink. It must be `DeeplinkType.Extension`. - `command` is the name of the command to deeplink to. - `launchType` is the type of the launch. - `arguments` is an object that contains the arguments to pass to the command. - `fallbackText` is the text to show if the command is not available. - For intra-extension deeplinks: - `ownerOrAuthorName` is the name of the owner or author of the extension. - `extensionName` is the name of the extension. #### Script command - `type` is the type of the deeplink. It must be `DeeplinkType.ScriptCommand`. - `command` is the name of the script command to deeplink to. - `arguments` is an array of strings to be passed as arguments to the script command. ### Return Returns a string. ## Example ```tsx import { Action, ActionPanel, LaunchProps, List } from "@raycast/api"; import { createDeeplink, DeeplinkType } from "@raycast/utils"; export default function Command(props: LaunchProps<{ launchContext: { message: string } }>) { console.log(props.launchContext?.message); return (