A powerful collection of interactive Svelte components for building modern web applications. Sveltool provides drag-and-drop functionality, magnification tools, note-taking capabilities, and advanced UI components with built-in styling.
npm install @tunjiadeyemi/sveltool
yarn add @tunjiadeyemi/sveltool
pnpm add @tunjiadeyemi/sveltool
<script>
import { Notepad, Magnifier, LineReader } from '@tunjiadeyemi/sveltool';
// Styles are automatically included
</script>
<!-- Draggable Notepad -->
<Notepad open={true} />
<!-- Magnifier with custom zoom -->
<Magnifier open={true} zoom={2} lensSize={250}>
<p>Your content to magnify goes here...</p>
</Magnifier>
<!-- Line Reader with blue background -->
<LineReader backgroundColor="blue" />
If styles don't load automatically, you can import them manually:
import '@tunjiadeyemi/sveltool/styles';
A draggable notepad component with persistent storage.
<script>
import { Notepad } from '@tunjiadeyemi/sveltool';
let isOpen = true;
function handleClose() {
isOpen = false;
}
</script>
<Notepad
open={isOpen}
handleClose={handleClose}
/>
Props:
open (boolean): Controls visibility of the notepadhandleClose (function): Callback function when close button is clickedInteractive magnification tool with draggable lens.
<script>
import { Magnifier } from '@tunjiadeyemi/sveltool';
</script>
<Magnifier
open={true}
zoom={3}
lensSize={200}
borderRadius={50}
>
<img src="your-image.jpg" alt="Content to magnify" />
<p>Any content can be magnified...</p>
</Magnifier>
Props:
open (boolean): Controls visibility of the magnifierzoom (number): Magnification level (default: 2)lensSize (number): Size of the magnification lens in pixels (default: 250)borderRadius (number): Border radius of the lens as percentage (default: 10)Customizable line reading tool with draggable and resizable functionality.
<script>
import { LineReader } from '@tunjiadeyemi/sveltool';
</script>
<LineReader backgroundColor="rgba(255, 255, 0, 0.3)" />
Props:
backgroundColor (string): Background color of the reading lineInteractive graph selection component for data visualization.
<script>
import { GraphSelector } from '@tunjiadeyemi/sveltool';
</script>
<GraphSelector />
Advanced ray selection tool for precise interactions.
<script>
import { RaySelector } from '@tunjiadeyemi/sveltool';
</script>
<RaySelector />
Sveltool comes with built-in Tailwind CSS styling. The styles are automatically included when you import any component.
You can override the default styles by targeting the component classes:
/* Override notepad styles */
.sveltool-notepad {
/* Your custom styles */
}
/* Override magnifier styles */
.magnifier-lens {
/* Your custom styles */
}
git clone https://github.com/tunjiadeyemi/sveltool.git
cd sveltool
npm install
npm run dev
Use this when working on components without adding new Tailwind CSS classes.
npm run dev:full
This is the recommended command for development! It automatically:
# Build CSS once (when you add new Tailwind classes)
npm run build:css
# Watch and rebuild CSS automatically
npm run build:css:watch
npm run package
Automatically builds CSS before packaging the library.
# Single command that handles everything
npm run dev:full
# Terminal 1: Watch CSS changes
npm run build:css:watch
# Terminal 2: Run dev server
npm run dev
Create your component in src/lib/components/YourComponent.svelte
Use Tailwind classes freely in your component
If using npm run dev:full → CSS rebuilds automatically ✨
If using npm run dev → Run npm run build:css when you add new classes
Export your component in src/lib/index.ts
Test in the demo by importing in src/routes/+page.svelte
Open http://localhost:5174 to view the demo
Build the library:
npm run package
Build and preview:
npm run build
npm run preview
Run type checking:
npm run check
Run continuous type checking:
npm run check:watch
We welcome contributions! Please see our Contributing Guidelines below.
mainnpm installnpm run dev:fullsrc/lib/components/ directorynpm run checknpm run package (CSS builds automatically)# 1. Start development with auto CSS building
npm run dev:full
# 2. Create a new component
touch src/lib/components/MyNewComponent.svelte
# 3. Export it in the main index
# Add to src/lib/index.ts
# 4. Add TypeScript types if needed
# Add to src/lib/types/index.ts
# 5. Test your component in the demo
# Edit src/routes/+page.svelte
# (CSS rebuilds automatically when you save!)
# 6. Build and test
npm run package
| Command | Purpose | When to Use |
|---|---|---|
npm run dev |
Standard development server | Working without new Tailwind classes |
npm run dev:full |
Recommended: Dev server + auto CSS rebuild | Adding new components/styles |
npm run build:css |
Build CSS once | After adding new Tailwind classes |
npm run build:css:watch |
Watch and rebuild CSS | Manual control over CSS building |
npm run package |
Build library for distribution | Before publishing/testing |
npm run check |
TypeScript type checking | Before committing |
This project is licensed under the MIT License - see the LICENSE file for details.
Tunji Adeyemi
If you have any questions or need help:
Made with ❤️ by Tunji Adeyemi