@molecule/app-action-menu-svelte
Svelte kebab / overflow action menu.
Exports ActionMenu — a compact popover menu with close-on-outside-click and
Escape key support — and the ActionMenuItem / ActionMenuProps types. It
is the Svelte counterpart of @molecule/app-action-menu-react: the same
props (React names) and the same DOM for the same input.
Auto-generated, AI-first package reference for the molecule.dev ecosystem.
It is written to be read by coding agents as much as by people, and is generated from this
package's source — edit src/index.ts JSDoc, not this file.
Quick Start
<script lang="ts">
import { ActionMenu } from '@molecule/app-action-menu-svelte'
</script>
<ActionMenu
items={[
{ id: 'edit', label: 'Edit', onClick: () => console.log('edit') },
{ id: 'duplicate', label: 'Duplicate', onClick: () => console.log('duplicate'), divider: true },
{ id: 'delete', label: 'Delete', onClick: () => console.log('delete'), destructive: true },
]}
align="right"
/>
Type
feature
Installation
npm install @molecule/app-action-menu-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
API
Interfaces
ActionMenuItem
A single item in the ActionMenu list.
interface ActionMenuItem {
/** Unique id. */
id: string
/** Label: text, or a snippet. */
label: string | Snippet
/** Optional leading icon: text, or a snippet. */
icon?: string | Snippet
/** Click handler. */
onClick?: () => void
/** Href — when present, the item renders as an anchor instead of a button. */
href?: string
/** When true, rendered in a disabled state. */
disabled?: boolean
/**
* Marks the item as destructive. Rendered in the theme's error color
* (`cm.textError`) with semibold weight, so it reads as red in both light
* and dark themes.
*/
destructive?: boolean
/** Insert a divider below this item. */
divider?: boolean
}
ActionMenuProps
Props accepted by the {@link ActionMenu} component.
interface ActionMenuProps {
/** Items to render. */
items: ActionMenuItem[]
/** Trigger content — usually a kebab icon. Defaults to "⋮": text, or a snippet. */
trigger?: string | Snippet
/** Menu alignment relative to the trigger. Defaults to `'right'`. */
align?: 'left' | 'right'
/**
* Accessible label for the trigger button. Overrides the translated /
* `defaultValue` `'Actions'` (prop > `t()` > default).
*/
triggerAriaLabel?: string
/** Extra classes on the outer wrapper. */
className?: string
}
Constants
ActionMenu
const ActionMenu: LegacyComponentType
Injection Notes
Requirements
Peer dependencies:
@molecule/app-svelte ^3.5.0 || ^4.0.0
@molecule/app-ui ^1.0.1
@molecule/app-ui-svelte ^1.1.0
svelte ^5.0.0
Runtime Dependencies
-
@molecule/app-svelte
-
@molecule/app-ui
-
@molecule/app-ui-svelte
-
svelte
-
Requires a bonded ClassMap (getClassMap() throws otherwise) and renders
through @molecule/app-ui-svelte's Button.
-
Pure uncontrolled: the component manages its own open state. For external
control use <Dropdown> from @molecule/app-ui-svelte.
-
Node-valued fields are snippets: trigger, and each item's label/icon
take text or a Snippet.
Translations
Translation strings are provided by @molecule/app-locales-action-menu.