# 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.

{% hint style="info" %}
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.
{% endhint %}

## Clipboard

The methods related to the [Clipboard](/api-reference/clipboard.md) can now be found under the `Clipboard` namespace.

```js
import { Clipboard } from "@raycast/api";

// deprecated copyTextToClipboard
await Clipboard.copy("text");

// deprecated clearClipboard
await Clipboard.clear();

// deprecated pasteText
await Clipboard.paste("text");
```

## Storage

The methods and interfaces related to the [Storage](/api-reference/storage.md) can now be found under the `LocalStorage` namespace.

```js
import { LocalStorage } from "@raycast/api";

// deprecated allLocalStorageItems
const items = await LocalStorage.allItems();

// deprecated getLocalStorageItem
const item = await LocalStorage.getItem("key");

// deprecated setLocalStorageItem
await LocalStorage.setItem("key", "value");

// deprecated removeLocalStorageItem
await LocalStorage.removeItem("key");

// deprecated clearLocalStorage
await LocalStorage.clear();

// we didn't expect you to use the Storage interfaces
// but they are now also under LocalStorage

// deprecated LocalStorageValue
LocalStorage.Value;

// deprecated LocalStorageValues
LocalStorage.Values;
```

## Feedback

The main changes to the [Feedback](/api-reference/feedback.md) 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`.

```js
import { showToast, Toast } from "@raycast/api";

// deprecated new Toast()
const toast = await showToast({ title: "Toast title" }); // Success by default

// deprecated showToast(ToastStyle.Failure, 'Toast title')
await showToast({ title: "Toast title", style: Toast.Style.Failure });
```

The interfaces and enumerations of both the Toast and Alert can now be found under their respective namespaces.

```js
import { Alert, Toast } from "@raycast/api";

// deprecated ToastOptions
Toast.Options;

// deprecated ToastActionOptions
Toast.ActionOptions;

// deprecated ToastStyle
Toast.Style;

// deprecated AlertOptions
Alert.Options;

// deprecated AlertActionOptions
Alert.ActionOptions;

// deprecated AlertActionStyle
Alert.ActionStyle;
```

## Keyboard

The interfaces related to the [Keyboard](/api-reference/keyboard.md) can now be found under the `Keyboard` namespace.

```js
import { Keyboard } from "@raycast/api";

// deprecated KeyboardShortcut
Keyboard.Shortcut;

// deprecated KeyModifier
Keyboard.KeyModifier;

// deprecated KeyEquivalent
Keyboard.KeyEquivalent;
```

## 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

```jsx
import { Action, List } from '@raycast/api'

// deprecated ActionPanel.Item
<Action title="Action title" onAction={() => {}}>

// deprecated CopyToClipboardAction
<Action.CopyToClipboard content="text">

// deprecated ListProps
List.Props
```

### Color

The interfaces related to the [Color](/api-reference/user-interface/colors.md) can now be found under the `Color` namespace.

```js
import { Color } from "@raycast/api";

// deprecated DynamicColor
Color.Dynamic;

// deprecated ColorLike
Color.ColorLike;
```

### Image

The interfaces and enumerations related to the [Image](/api-reference/user-interface/icons-and-images.md) can now be found under the `Image` namespace. `Icon` is still a top-level export.

```js
import { Image } from "@raycast/api";

// deprecated ImageLike
Image.ImageLike;

// deprecated ImageSource
Image.Source;

// deprecated ImageMask
Image.Mask;
```

## Misc

* We are deprecating the `randomId` utility. It wasn't related to Raycast. Instead, you can use the [`nanoid`](https://github.com/ai/nanoid#readme) 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.raycast.com/misc/migration/v1.28.0.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
