raycast-toolkit
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Raycast Toolkit

This is an unofficial package to develop Raycast Extensions that provides additional hooks and components useful to perform more advanced operations.

Documentation

Note: the exported namespaces are suffixed with a dollar sign ($) to avoid to conflict with the @raycast/api ones.

Components

Action$.SelectFile

When this action is called, a Finder file prompt window will be displayed, the user can select the file they prefer and the onSelect callback will be called with the POSIX path of the chosen file.

import { ActionPanel } from '@raycast/api';
import { Action$ } from 'raycast-toolkit';

const Example = () => (
  <ActionPanel>
    <Action$.SelectFile
      prompt="Select a .csv file"
      type="csv"
      onSelect={(path) => console.log('Selected file at path:', path)}
    />
  </ActionPanel>
);

Hooks

usePersistentState

Provides an interface compatible with useState but that persists its value on the Raycast LocalStorage.

import { usePersistentState } from 'raycast-toolkit';

const [persistentCounter, setPersistentCounter] = usePersistentState(
  'my-state-key', // LocalStorage key
  0 // initial value
);

Readme

Keywords

none

Package Sidebar

Install

npm i raycast-toolkit

Weekly Downloads

3

Version

1.0.6

License

MIT

Unpacked Size

5.04 kB

Total Files

8

Last publish

Collaborators

  • fezvrasta