Skip to main content

Quick Start

This guide will walk you through creating your first interactive UI with Svelte Atoms Core. We’ll build a complete form with a dialog, demonstrating the library’s composability and reactivity.

What We’ll Build

We’ll create a user registration form with:
  • Input fields for name and email
  • A button to open a confirmation dialog
  • A dialog with header, body, and footer sections
  • Reactive state management using Svelte 5 runes
1

Create a New Component

Create a new file called RegistrationForm.svelte in your project:
RegistrationForm.svelte
Notice we’re using Svelte 5’s $state rune for reactive state. This is the recommended way to manage state in Svelte 5.
2

Build the Form

Add the form structure with input fields:
RegistrationForm.svelte
The Input component is composed of Input.Root and Input.Control. This pattern allows for flexible composition with icons, placeholders, and other elements.
3

Add the Confirmation Dialog

Add a dialog that appears after form submission:
RegistrationForm.svelte
The Dialog.Root component manages the dialog state. By binding to the open prop, we can control the dialog from our component logic.
4

Complete Component Code

Here’s the complete component code:
RegistrationForm.svelte

Advanced Example: Searchable Dropdown

Let’s create a more advanced component - a multi-select dropdown with search functionality:
FruitSelector.svelte
This example demonstrates:
  • Composition using the base prop to combine Input and Dropdown
  • Snippets for flexible content rendering
  • Animation using Svelte’s flip animation
  • Filter helper for reactive search functionality

Key Concepts

Composition with base

The base prop allows you to use one component as the foundation for another:

Component Structure

Many components follow a Root/Content pattern:

Reactive State with Runes

Use Svelte 5 runes for reactive state:

Next Steps

Now that you’ve built your first components, explore more:

Component Library

Explore all 30+ components with examples

Styling Guide

Learn how to customize component styles

Composition Patterns

Master advanced composition techniques

API Reference

Deep dive into component APIs and props

Need Help?

View Examples

Check out the Storybook for interactive examples of every component