using-obsidian-api
SKILL.md
Obsidian Bases API
Main types
BasesEntry: Represents a note/entry with propertiesBasesViewConfig: View configuration (user options)BasesPropertyId: Property identifier (string)App: Obsidian application instanceTFile: Obsidian file
Data access
// Get property value
const value = entry.getValue(propertyId);
// Get property display name
const displayName = config.getDisplayName(propertyId);
// Get image (resolves internal and external paths)
import { getResourcePath } from "@/lib/obsidian/link";
const imageSrc = getResourcePath(app, imageUrl, entry.file.path);
Context
The Obsidian context exposes shared Obsidian variables.
const { app, component, containerEl, isEmbedded } = useObsidian();
Available hooks
Define and use reusable hooks to wrap Obsidian features in src/hooks to simplify the workflow and increase reusability
// Get config value with default
const layout = useConfigValue<"vertical" | "horizontal">("layout", "vertical");
// Get entry data
const entry = useEntry(entryId);
// Get entry property
const property = useEntryProperty(entryId, propertyId);
// Get entry image
const imageSrc = useEntryImage(entryId);
// Get entry title
const title = useEntryTitle(entryId);
// Handler to open entry
const handleOpen = useEntryOpen(entryId);
// Handler for hover with preview
const handleHover = useEntryHover(entryId, linkRef);