Our API includes a few built-in actions that can be used for common interactions, such as opening a link or copying some content to the clipboard. By using them, you make sure to follow our human interface guidelines. If you need something custom, use the Action component. All built-in actions are just abstractions on top of it.
API Reference
Action
A context-specific action that can be performed by the user.
Assign keyboard shortcuts to items to make it easier for users to perform frequently used actions.
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
import { ActionPanel, Detail, Action } from"@raycast/api";import { homedir } from"os";constDESKTOP_DIR=`${homedir()}/Desktop`;exportdefaultfunctionCommand() {return (<Detail markdown="What do you want to use to open your desktop with?" actions={ <ActionPanel> <Action.OpenWith path={DESKTOP_DIR} /> </ActionPanel> }/> );}
Props
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
import { ActionPanel, Detail, Action } from"@raycast/api";exportdefaultfunctionCommand() {return (<Detail markdown="Let us know what you think about the Raycast API?" actions={ <ActionPanel> <Action.Paste content="api@raycast.com"/> </ActionPanel> }/> );}
Props
Action.Push
Action that pushes a new view to the navigation stack.
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
Action.PickDate.isFullDay
A method that determines if a given date represents a full day or a specific time.
import { ActionPanel, List, Action } from"@raycast/api";exportdefaultfunctionCommand() {return ( <List> <List.Itemtitle="Todo"actions={ <ActionPanel> <Action.PickDatetitle="Set Due Date…"onChange={(date) => {if (Action.PickDate.isFullDay(values.reminderDate)) {// the event is for a full day } else {// the event is at a specific time } }} /> </ActionPanel> } /> </List> );}