Action
The ctx.action API allows your plugin to add UI elements that trigger custom actions to different parts of the Seanime interface.
Core Methods
newAnimePageButton
Creates a button that appears on anime detail pages.
Parameters:
props: Object containing:label: String - Button textintent: String (Optional) - Button style ("primary", "success", "warning", etc.)style: Object (Optional) - Custom CSS styles
Example:
// Create a play button for anime pages
const playButton = ctx.action.newAnimePageButton({
label: "Play All Episodes",
intent: "primary",
style: { marginRight: "8px" }
})
// Mount the button to make it visible
playButton.mount()
// Handle clicks
playButton.onClick((event) => {
const anime = event.media
console.log(`Play all episodes for: ${anime.title.userPreferred}`)
// Implement playback logic
})newAnimePageDropdownItem
Creates a dropdown menu item that appears in the anime page's action menu.
Parameters:
props: Object containing:label: String - Menu item textstyle: Object (Optional) - Custom CSS styles
Example:
newAnimeLibraryDropdownItem
Creates a dropdown menu item that appears in the anime library's global action menu.
Parameters:
props: Object containing:label: String - Menu item textstyle: Object (Optional) - Custom CSS styles
Example:
newMediaCardContextMenuItem
Creates a context menu item that appears when right-clicking on media cards.
Parameters:
props: Object containing:label: String - Menu item textfor: String (Optional) - Which media types to show for ("anime", "manga", or "both")style: Object (Optional) - Custom CSS styles
Example:
newMangaPageButton
Creates a button that appears on manga detail pages.
Parameters:
props: Object containing:label: String - Button textintent: String (Optional) - Button style ("primary", "success", "warning", etc.)style: Object (Optional) - Custom CSS styles
Example:
newEpisodeCardContextMenuItem
Creates an item that appears on episode card context menus.
Parameters:
props: Object containing:label: String - Button textstyle: Object (Optional) - Custom CSS styles
newEpisodeGridItemMenuItem
Creates an item that appears on episode grid item menus.
Parameters:
props: Object containing:label: String - Button texttype: "library" | "torrentstream" | "debridstream" | "onlinestream" | "undownloaded" | "medialinks" | "mediastream"style: Object (Optional) - Custom CSS styles
Action Object Methods
All action objects share these common methods:
mount()
Makes the action visible in the UI.
Example:
unmount()
Removes the action from the UI.
Example:
setLabel(label)
Updates the action's label text.
Parameters:
label: String - New label text
Example:
setStyle(style)
Updates the action's custom CSS styles.
Parameters:
style: Object - CSS style properties
Example:
onClick(callback)
Sets a function to be called when the action is clicked.
Parameters:
callback: Function(event) - Function to call when clicked
Example:
Additional Properties
AnimePageButton and MangaPageButton
These button types have an additional method:
setIntent(intent)
Sets the button's visual style.
Parameters:
intent: String - Intent style ("primary", "success", "warning", "error", etc.)
Example:
MediaCardContextMenuItem
This action type has an additional method:
setFor(type)
Sets which media types the context menu item appears for.
Parameters:
type: String - "anime", "manga", or "both"
Example:
Best Practices
Limit Number of Actions
Each plugin is limited to a maximum of 3 actions per type. Choose the most important actions to display.
Dynamic UI Updates
Update action properties based on application state:
Conditional Mounting
Only mount actions when they're relevant:
Last updated