Skip to main content

Overview

Svelte Atoms Core is built with full TypeScript support, providing comprehensive type definitions for all components, props, and state management utilities. Get IDE autocompletion, type checking, and inline documentation out of the box.

Type-Safe Components

Component Props

All components have fully-typed props interfaces:

Using Component Types

Generic Component Props

Many components support generic element types:

Element Type Customization

Bond Types

Bond State Types

Bonds are strongly typed with state interfaces:

Using Bond Types

Variant Types

defineVariants Type Safety

Variants are fully typed with autocompletion:

Using Variant Types

Utility Types

Override Type

Deep merge types for prop overriding:

Factory Type

Type-safe bond factories:

Component Type Extension

Extending Component Props

Add custom properties to components:

Using Extended Props

Type-Safe State Management

Typed Runes

Custom Runes Types

Advanced Patterns

Type-safe global presets:

Type Safety Best Practices

1

Use explicit type imports

Import types separately for clarity:
2

Type component props

Always type your component props:
3

Leverage type inference

Let TypeScript infer types when possible:
4

Extend component types

Use declaration merging for custom props:

Common Type Patterns

Event Handlers

Snippet Types

Bond Factories

Next Steps

Using Components

Learn component composition patterns

State Management

Type-safe state with bonds

Customization

Typed variants and styling

API Reference

Complete type documentation