v1.28.0
This version contains an overhaul of the API surface to improve its discoverability and its usage in a code editor. The aim was to reduce the number of top-level exports to make it easier to find the ones that matter. It also aligns it with the structure of the documentation.
The previous API surface is still there, only deprecated. All of your existing extensions will continue to work. You will get helpful hints in your code editor to migrate your extension.

Clipboard

The methods related to the Clipboard can now be found under the Clipboard namespace.
1
import { Clipboard } from "@raycast/api";
2
3
// deprecated copyTextToClipboard
4
await Clipboard.copy("text");
5
6
// deprecated clearClipboard
7
await Clipboard.clear();
8
9
// deprecated pasteText
10
await Clipboard.paste("text");
Copied!

Storage

The methods and interfaces related to the Storage can now be found under the LocalStorage namespace.
1
import { LocalStorage } from "@raycast/api";
2
3
// deprecated allLocalStorageItems
4
const items = await LocalStorage.allItems();
5
6
// deprecated getLocalStorageItem
7
const item = await LocalStorage.getItem("key");
8
9
// deprecated setLocalStorageItem
10
await LocalStorage.setItem("key", "value");
11
12
// deprecated removeLocalStorageItem
13
await LocalStorage.removeItem("key");
14
15
// deprecated clearLocalStorage
16
await LocalStorage.clear();
17
18
// we didn't expect you to use the Storage interfaces
19
// but they are now also under LocalStorage
20
21
// deprecated LocalStorageValue
22
LocalStorage.Value;
23
24
// deprecated LocalStorageValues
25
LocalStorage.Values;
Copied!

Feedback

The main changes to the Feedback methods are related to the Toast:
showToast now accepts a Toast.Options object as an argument and its style will default to Toast.Style.Success.
1
import { showToast, Toast } from "@raycast/api";
2
3
// deprecated new Toast()
4
const toast = await showToast({ title: "Toast title" }); // Success by default
5
6
// deprecated showToast(ToastStyle.Failure, 'Toast title')
7
await showToast({ title: "Toast title", style: Toast.Style.Failure });
Copied!
The interfaces and enumerations of both the Toast and Alert can now be found under their respective namespaces.
1
import { Alert, Toast } from "@raycast/api";
2
3
// deprecated ToastOptions
4
Toast.Options;
5
6
// deprecated ToastActionOptions
7
Toast.ActionOptions;
8
9
// deprecated ToastStyle
10
Toast.Style;
11
12
// deprecated AlertOptions
13
Alert.Options;
14
15
// deprecated AlertActionOptions
16
Alert.ActionOptions;
17
18
// deprecated AlertActionStyle
19
Alert.ActionStyle;
Copied!

Keyboard

The interfaces related to the Keyboard can now be found under the Keyboard namespace.
1
import { Keyboard } from "@raycast/api";
2
3
// deprecated KeyboardShortcut
4
Keyboard.Shortcut;
5
6
// deprecated KeyModifier
7
Keyboard.KeyModifier;
8
9
// deprecated KeyEquivalent
10
Keyboard.KeyEquivalent;
Copied!

Preferences

We are deprecating the preferences constant because we found it to be error-prone. Instead, you should always use getPreferenceValues() which allows for a type-safe access with fallback to the defaults.

User Interface

There are two important changes related to the React components:
  • ActionPanel.Item has been renamed to Action. All the specific actions are now nested under Action. This will make it easier to introduce and teach the concept of Action.
  • All the props interfaces are now accessible under their respective components
1
import { Action, List } from '@raycast/api'
2
3
// deprecated ActionPanel.Item
4
<Action title="Action title" onAction={() => {}}>
5
6
// deprecated CopyToClipboardAction
7
<Action.CopyToClipboard content="text">
8
9
// deprecated ListProps
10
List.Props
Copied!

Color

The interfaces related to the Color can now be found under the Color namespace.
1
import { Color } from "@raycast/api";
2
3
// deprecated DynamicColor
4
Color.Dynamic;
5
6
// deprecated ColorLike
7
Color.ColorLike;
Copied!

Image

The interfaces and enumerations related to the Image can now be found under the Image namespace. Icon is still a top-level export.
1
import { Image } from "@raycast/api";
2
3
// deprecated ImageLike
4
Image.ImageLike;
5
6
// deprecated ImageSource
7
Image.Source;
8
9
// deprecated ImageMask
10
Image.Mask;
Copied!

Misc

  • We are deprecating the randomId utility. It wasn't related to Raycast. Instead, you can use the nanoid dependency.
  • We are deprecating the useId hook. It was used internally but there shouldn't be a use-case for it in your extensions.
  • We are deprecating the useActionPanel hook. Use the ActionPanel component instead.
  • We are deprecating the render method. You should export default your root component instead.
Last modified 3d ago