https://github.com/user-attachments/assets/d0e41510-399f-4937-a94d-151481f66c3c
A customizable grid overlay system for SvelteKit applications to help with layout design and alignment.
bun add @iamjuney/svelte-grid-guide
This package requires Tailwind CSS v4. If you're experiencing style issues, make sure Tailwind CSS is properly set up in your project.
# Install Tailwind CSS v4 if not already installed
bunx sv add tailwindcss
## Peer Dependencies
This package requires the following peer dependencies:
- `bits-ui` (^1.3.18)
- `phosphor-svelte` (^3.0.1)
Make sure to install these dependencies in your project:
```bash
bun add bits-ui phosphor-svelte
<!-- src/routes/+layout.svelte -->
<script>
import { GridOverlay } from '@iamjuney/svelte-grid-guide';
</script>
<GridOverlay />
<!-- Your app content here -->
<script>
import { GridOverlay } from '@iamjuney/svelte-grid-guide';
const gridOptions = {
columns: 12,
maxWidth: 1200,
gap: 24
// More options available
};
</script>
<GridOverlay options={gridOptions} position="bottom-left" />
Position the controls with: top-left
, top-right
, bottom-left
, bottom-right
(default), top-center
, or bottom-center
.
Option | Type | Default | Description |
---|---|---|---|
columns |
number | 12 | Number of columns |
maxWidth |
number | 1200 | Maximum width (px) |
gap |
number | 24 | Gap between columns (px) |
opacity |
number | 0.2 | Grid opacity |
color |
string | '#ff0000' | Column color |
showMargins |
boolean | true | Show/hide margins |
marginColor |
string | '#0000ff' | Margin color |
padding |
number | 16 | Horizontal padding (px) |
zIndex |
number | 9999 | Z-index value |
visible |
boolean | false | Initial visibility |
class |
string | undefined | Custom CSS class |
<script>
import { GridOverlay, gridOverlay } from '@iamjuney/svelte-grid-guide';
// Available methods:
// gridOverlay.show()
// gridOverlay.hide()
// gridOverlay.toggle()
// gridOverlay.setOptions({...})
// gridOverlay.resetOptions()
// gridOverlay.setMobileOptions()
</script>
<GridOverlay />
<button onclick={() => gridOverlay.toggle()}>Toggle Grid</button>
If you're experiencing styling issues:
MIT