UI blocks
A block is a whole page section built from the SvGrid UI components: a sign-in
screen, a 404 page, a pricing table, an empty state. Each one is a single
.svelte file that imports from @svgrid/grid and nothing else. You copy it into
your app and change it like any other file you own.
Blocks are free and MIT-licensed, like the components they are made of.
Add a block
Add one block by name, or a whole group at once:
That writes one file per block into
src/lib/components/ui/ (or the componentsDir in your svgrid.json) and
installs @svgrid/grid if it is missing. To look before you add,
npx @svgrid/ui try blocks/auth opens the group in a sandbox with a theme picker
and a dark mode toggle. No project needed.
npx @svgrid/ui list prints every block group and the blocks in it.
If your app already uses shadcn-svelte, every block is also served from
https://svgrid.com/r/<name>.json:
npx shadcn-svelte@latest add https://svgrid.com/r/login.json
Headless first
Every block is headless, like the components. The top of each file, its
<script module>, holds a create<Name>() core: the state, validation, async
flow and accessible prop-getters, with no markup. The styled component below it
is one render of that core. To draw your own markup over the same behaviour,
take the core alone:
npx @svgrid/ui add auth-forgot-password --headless # writes auth-forgot-password.svelte.ts
<script lang="ts">
import { createForgotPassword } from './auth-forgot-password.svelte.js'
const reset = createForgotPassword({
onRequest: async (email) => {
const r = await fetch('/api/password-reset', { method: 'POST', body: JSON.stringify({ email }) })
if (!r.ok) throw new Error('Reset failed')
},
})
</script>
{#if reset.sentTo}
<p>We sent a link to {reset.sentTo}.</p>
<button {...reset.resendProps()}>Resend{reset.cooldown ? ` in ${reset.cooldown}s` : ''}</button>
{:else}
<form {...reset.formProps()}>
<input {...reset.fieldProps()} />
{#if reset.error}<p>{reset.error}</p>{/if}
<button disabled={reset.busy}>Send reset link</button>
</form>
{/if}
If you keep the styled file, the core is still importable from it:
import { createForgotPassword } from './auth-forgot-password.svelte'.
What you get in the file
- Components, not markup copies. The inputs, buttons, cards and toasts are
Sv*components. Their keyboard handling, validation and accessibility come from the package, so a@svgrid/gridupdate fixes them in every block you have copied. - Theme tokens. Colors, borders and radii come from the
--sg-*custom properties, so a block follows whichever theme preset or dark mode your app uses. - Prefixed classes. Every class a block defines starts with
sv-and a block-specific stem (sv-signin-head), so your app's global CSS and the block's styles never match each other's elements. - No assets to host. Logos, illustrations and photos are inline SVG or CSS.
- Phones. Every block is checked at 375 px wide.
- Working state. Forms validate, buttons show a loading state, and submits fire a toast. Replace the toast call with your own request.
Groups
| Group | Add it | Blocks |
|---|---|---|
| Sign-in & registration | add blocks/auth |
Split login, sign-up, two-factor code, SSO and magic link, forgot password |
| Error pages | add blocks/error-pages |
404 with search, 500 with retry, maintenance, 403 |
| Empty states | add blocks/empty-states |
First item, upload drop zone, no search results, widget cards |
| Form layouts | add blocks/form-layouts |
Stacked, two-column, notification settings, settings with side nav, danger zone |
| Page headings | add blocks/page-headings |
Breadcrumbs, tabs, record meta, stats |
| Onboarding | add blocks/onboarding |
Setup wizard, progress checklist |
| App shells & dashboards | add blocks/app-shells |
Analytics dashboard, sidebar app shell |
| KPI cards | add blocks/kpi-cards |
With icons, with trend, live sparklines |
| Stats | add blocks/stats |
Weekly report with CSV export, status board |
| Filter panels | add blocks/filter-panels |
Sidebar facets, toolbar, applied chips, collapsible filters over an SvGrid |
| Activity feeds | add blocks/activity-feeds |
Activity timeline, notification list, comment thread, audit log |
| AI assistant | add blocks/ai |
Prompt suggestions, ask bar over an SvGrid, model settings |
| Orders | add blocks/orders |
Order history on SvGrid, order tracking |
| Banners | add blocks/banners |
Announcement bar, inline alerts, cookie consent, billing warning |
| Navbars | add blocks/navbars |
Simple, storefront with search, mega menu |
| Footers | add blocks/footers |
Sitemap, simple |
| Checkout | add blocks/checkout |
Split, stepped, payment methods, order confirmation |
| Shopping carts | add blocks/shopping-carts |
Cart page, slide-over cart |
| Reviews | add blocks/reviews |
Rating summary, review list, write a review |
| Contact | add blocks/contact |
Contact form, contact cards, support request with hours |
| Hero | add blocks/hero |
Centered, with email sign-up |
| Features | add blocks/features |
Icon grid, list with screenshot |
| Call to action | add blocks/cta |
Centered, justified |
| Pricing | add blocks/pricing |
Three tiers with billing toggle, per-seat with highlighted plan, comparison table |
| FAQ | add blocks/faq |
Accordion with search, centered with topics |
| Bento grids | add blocks/bento |
Feature bento |
| Testimonials | add blocks/testimonials |
Quote cards, carousel |
| Logo clouds | add blocks/logo-clouds |
Customer wordmark grid |
| Team | add blocks/team |
Team grid with department filter |
| Product cards | add blocks/product-cards |
Card grid, horizontal card |
| Product lists | add blocks/product-lists |
List with sort and view toolbar, featured product |
| Product overview | add blocks/product-overview |
Gallery, variants and add to cart |
| Blog | add blocks/blog |
Post cards with category filter, featured article |
Every block also has a live page in the demo gallery, under SvGrid UI > Blocks, one page per group.
A few to start with
404 with search
A site search that filters a list of popular pages as you type, for the page a broken link lands on.
Ask bar over a grid
A plain-language question filters or summarizes an SvGrid of invoices through
the free AI helpers, offline with the mock provider.
Open the live example: Ask bar block (Blocks)
Split checkout
Contact, shipping, delivery and card fields beside a sticky order summary, with every field validated before Pay.
See also
Live examples
- 404 with helpful links block - Site search SvTextInput with a leading icon that filters a list of popular pages as you type (icon, title, description, chevron). An empty search shows a field error; a real query fires a toast.
- Ask bar block - An Ask about your data bar over 30 invoices in an SvGrid. aiFilter turns a question into grid filters and a sort; summarize questions run aiSummarize over the rows on screen. SvChip suggestions, an SvAlert error state and Clear.
- Split checkout block - One-page checkout with SvTextInput, SvCountryInput, a delivery SvRadioGroup and SvMaskedInput card fields beside a sticky order summary. Pay checks every field (Luhn check, expiry not in the past), then shows SvButton loading and a toast.
- Login block - A two-column authentication page: a branded gradient panel beside a sign-in SvCard with social SvButtons, SvTextInput + SvPasswordInput (reveal), remember-me SvCheckBox, an "or" SvDivider and forgot-password link. Drops into any route as-is.