Actions
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.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
title* | The title displayed for the Action. |
| - |
autoFocus | Indicates whether the Action should be focused automatically when the parent ActionPanel (or Actionpanel.Submenu) opens. |
| - |
icon | The icon displayed for the Action. | - | |
shortcut | The keyboard shortcut for the Action. | - | |
style | Defines the visual style of the Action. | ||
onAction | Callback that is triggered when the Action is selected. |
| - |
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
Props
Prop | Description | Type | Default |
---|---|---|---|
content* | The contents that will be copied to the clipboard. |
| - |
concealed | Indicates whether the content be treated as confidential. If |
|
|
icon | A optional icon displayed for the Action. | ||
shortcut | The keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
|
|
onCopy | Callback when the content was copied to clipboard. |
| - |
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
Props
Prop | Description | Type | Default |
---|---|---|---|
target* | The file, folder or URL to open. |
| - |
title* | The title for the Action. |
| - |
application | The application name to use for opening the file. |
| - |
icon | The icon displayed for the Action. | ||
shortcut | The keyboard shortcut for the Action. | - | |
onOpen | Callback when the file or folder was opened. |
| - |
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
Props
Prop | Description | Type | Default |
---|---|---|---|
url* | The URL to open. |
| - |
icon | The icon displayed for the Action. | ||
shortcut | The optional keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
|
|
onOpen | Callback when the URL was opened in the browser. |
| - |
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
Props
Prop | Description | Type | Default |
---|---|---|---|
path* | The path to open. |
| - |
icon | The icon displayed for the Action. | ||
shortcut | The keyboard shortcut for the Action. | - | |
title | The title for the Action. |
|
|
onOpen | Callback when the file or folder was opened. |
| - |
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
Props
Prop | Description | Type | Default |
---|---|---|---|
content* | The contents that will be pasted to the frontmost application. |
| - |
icon | The icon displayed for the Action. | ||
shortcut | The keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
|
|
onPaste | Callback when the content was pasted into the front-most application. |
| - |
Action.Push
Action that pushes a new view to the navigation stack.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
target* | The target view that will be pushed to the navigation stack. |
| - |
title* | The title displayed for the Action. |
| - |
icon | The icon displayed for the Action. | - | |
shortcut | The keyboard shortcut for the Action. | - | |
onPop | Callback when the target view will be popped. |
| - |
onPush | Callback when the target view was pushed. |
| - |
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
Props
Prop | Description | Type | Default |
---|---|---|---|
path* | The path to open. | - | |
icon | A optional icon displayed for the Action. | ||
shortcut | The keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
|
|
onShow | Callback when the file or folder was shown in the Finder. |
| - |
Action.SubmitForm
Action that adds a submit handler for capturing form values.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
icon | The icon displayed for the Action. | - | |
shortcut | The keyboard shortcut for the Action. | - | |
style | Defines the visual style of the Action. | ||
title | The title displayed for the Action. |
|
|
onSubmit | Callback when the Form was submitted. The handler receives a the values object containing the user input. |
| - |
Action.Trash
Action that moves a file or folder to the Trash.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
paths* | The item or items to move to the trash. | - | |
icon | A optional icon displayed for the Action. | ||
shortcut | The optional keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
|
|
onTrash | Callback when all items were moved to the trash. | - |
Action.CreateSnippet
Action that navigates to the the Create Snippet command with some or all of the fields prefilled.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
snippet* | - | ||
icon | A optional icon displayed for the Action. See Image.ImageLike for the supported formats and types. | - | |
shortcut | The keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
| - |
Action.CreateQuicklink
Action that navigates to the the Create Quicklink command with some or all of the fields prefilled.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
quicklink* | The Quicklink to create. | - | |
icon | A optional icon displayed for the Action. See Image.ImageLike for the supported formats and types. | - | |
shortcut | The keyboard shortcut for the Action. | - | |
title | An optional title for the Action. |
| - |
Action.ToggleQuickLook
Action that toggles the Quick Look to preview a file.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
icon | The icon displayed for the Action. | ||
shortcut | The keyboard shortcut for the Action. | - | |
title | The title for the Action. |
|
|
Action.PickDate
Action to pick a date.
Example
Props
Prop | Description | Type | Default |
---|---|---|---|
title* | A title for the Action. |
| - |
onChange* | Callback when the Date was picked |
| - |
icon | A optional icon displayed for the Action. | ||
max | The maximum date (inclusive) allowed for selection. |
| - |
min | The minimum date (inclusive) allowed for selection. |
| - |
shortcut | The keyboard shortcut for the Action. | - | |
type | Indicates what types of date components can be picked | - |
Types
Snippet
Properties
Property | Description | Type |
---|---|---|
text* | The snippet contents. |
|
keyword | The keyword to trigger the snippet. |
|
name | The snippet name. |
|
Quicklink
Properties
Property | Description | Type |
---|---|---|
link* | The URL or file path, optionally including placeholders such as in "https://google.com/search?q={Query}" |
|
application | The application that the quicklink should be opened in. |
|
icon | The icon to display for the quicklink. | |
name | The quicklink name |
|
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.
Last updated