TypeScript Types Reference
Complete reference for TypeScript types and interfaces in the Sofondo Framework.
Installation
All types are included with the respective packages:
npm install @sofondo/core @sofondo/react
Usage
Import types from package type definitions:
import type { ResolvedConfig, NavigationAdapter } from '@sofondo/core/types';
import type { TableOfContentsProps, TocHeading } from '@sofondo/core/types';
TypeScript Types
Configuration Types
// User configuration (all optional)
type UserConfig = Partial<SofondoConfig>;
// Resolved configuration (all required)
type ResolvedConfig = Required<{
[K in keyof SofondoConfig]: Required<NonNullable<SofondoConfig[K]>>;
}>;
// Individual section types
type ThemeConfig = { /* ... */ };
type SidebarConfig = { /* ... */ };
type AnimationsConfig = { /* ... */ };
type ComponentsConfig = { /* ... */ };
type AccessibilityConfig = { /* ... */ };
type DevConfig = { /* ... */ };
Component Types
// Menu item for navigation
interface MenuItem {
icon: LucideIcon;
label: string;
href?: string;
exact?: boolean;
children?: MenuItem[];
}
// Column definition for DataGrid
interface Column<T> {
key: keyof T;
header: string;
width?: string;
align?: 'left' | 'center' | 'right';
render?: (item: T) => ReactNode;
}
// Breadcrumb item
interface BreadcrumbItem {
icon?: LucideIcon;
label: string;
href?: string;
}
Navigation Adapter
For framework-agnostic components:
interface NavigationAdapter {
Link: ComponentType<{ href: string; children: ReactNode; className?: string }>;
usePathname: () => string;
}
// Next.js adapter
import { nextjsNavigationAdapter } from '@sofondo/next';
// Custom adapter
const customAdapter: NavigationAdapter = {
Link: ({ href, children, className }) => (
<a href={href} className={className}>{children}</a>
),
usePathname: () => window.location.pathname,
};