Docs / api
API.
The surface is intentionally small. One factory, one instance.
Factory
import snapdeck from '@snapdeck/core';
import type { SnapdeckOptions, SnapdeckInstance } from '@snapdeck/core';
const api: SnapdeckInstance = snapdeck(
target: HTMLElement | string,
options?: Partial<SnapdeckOptions>,
);Methods
api.moveTo(target: AnchorOrIndex): Promise<void>
api.moveSectionUp(): Promise<void>
api.moveSectionDown(): Promise<void>
api.moveSlideLeft(): Promise<void>
api.moveSlideRight(): Promise<void>
api.setOption<K>(key: K, value: SnapdeckOptions[K]): void
api.on(event, handler): Unsubscribe
api.off(event, handler): void
api.destroy(): voidState
api.state: {
readonly activeIndex: number;
readonly activeAnchor: string | null;
readonly isMoving: boolean;
readonly sections: ReadonlyArray<Section>;
readonly viewport: { width: number; height: number };
};Types
All public types are exported from @snapdeck/core and re-exported from framework wrappers.