Skip to content

Frog.castAction

Import

import { Frog } from 'frog'

Usage

import { Button, Frog } from 'frog'
 
const app = new Frog()
 
app.castAction('/', (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  {
    name: 'My Action',
    icon: 'log'
  }
)

Parameters

path

  • Type: string

Path of the route.

Read more.

import { Button, Frog } from 'frog'
 
const app = new Frog()
 
app.castAction(
  '/foo/bar',
  (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  {
    name: 'My Action',
    icon: 'log'
  }
)

handler

  • Type: (c: Context) => CastActionResponse

Handler function for the route.

import { Button, Frog } from 'frog'
 
const app = new Frog()
 
app.castAction(
  '/foo/bar',
  (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  { 
    name: 'My Action',
    icon: 'log'
  }
) 

options

  • Type: RouteOptions<'castAction'>

Options for a Cast Action

import { Button, Frog } from 'frog'
 
const app = new Frog()
 
app.castAction(
  '/foo/bar',
  (c) => {
    return c.message({ message: 'Action Succeeded' })
  },
  { 
    aboutUrl: 'https://frog.fm/reference/frog-cast-action',
    name: 'My Action',
    description: 'My awesome action.',
    icon: 'log'
  }
) 

Context Parameter

See the Cast Action Context API.

Action Response

See the Cast Action Response API.