A Svelte 5 design system. Customisable, composable and accessible. WCAG-focused and theme driven.
npm i @abhc/spektral-ui
Import the token file once in your app entry point (e.g. +layout.svelte):
import '@abhc/spektral-ui/tokens.css';
Then use components anywhere:
<script>
import { Button, Card, Badge } from '@abhc/spektral-ui';
</script>
<Card>
<Badge palette="success">New</Badge>
<Button palette="accent">Get started</Button>
</Card>
40+ components across layout, controls, overlays, feedback and content.
| Component | Description |
|---|---|
Header |
App header shell |
Footer |
App footer shell |
Nav |
Navigation bar |
Hero |
Full-width section with layout presets, palette, SVG pattern backgrounds and mask effects |
TileGrid |
Responsive grid with pattern background support |
Explorer / ExplorerGroup / ExplorerLink |
File-tree style sidebar navigation |
| Component | Description |
|---|---|
Button |
Multi-variant button (flat, outlined, ghost, naked) with animation and direction options |
Badge |
Inline label with palette, size, elevation and optional trailing action |
Input |
Text input |
Textarea |
Multiline text input |
Select |
Dropdown select built on Popover |
CheckboxGroup |
Checkbox list |
RadioGroup |
Radio button list |
Switch |
Toggle switch |
Slider |
Range slider |
SearchField |
Search input with clear action |
ColorPicker |
OKLCH color picker with hex input |
Selector / ControlBar |
Segmented control / tab bar |
| Component | Description |
|---|---|
Drawer |
Side panel overlay |
Modal |
Dialog overlay |
Popover |
Anchored floating panel with direction and alignment options |
Tooltip |
Hover tooltip with direction and size variants |
Command |
Command palette / search modal |
| Component | Description |
|---|---|
Alert |
Toast/notification with semantic variants and viewport positioning |
Callout |
Highlighted text block |
Progress |
Progress bar |
| Component | Description |
|---|---|
Card |
Content container with variant, elevation and rounding options |
ListItem |
Structured list row |
Accordion / AccordionHeader |
Collapsible content sections |
DataTable |
Sortable data table |
CodeBlock |
Syntax-highlighted code with copy, filename, tabs and terminal variants |
Avatar |
User avatar with fallback initials |
Headline |
Display heading with palette and size variants |
Timeline / TimelineItem |
Timeline layout |
Marquee |
Scrolling content strip |
Support |
"Built with Spektral" attribution badge |
SwatchRow |
Color swatch display row |
| Component | Description |
|---|---|
LogoSpektral |
Spektral UI logo asset |
Support |
"Built with Spektral" attribution badge |
All components share a consistent prop vocabulary:
variant — visual style: flat · outlined · ghost · nakedpalette — semantic color: accent · tone · neutral · error · warning · success · infosize — sm · md · lgelevation — shadow level: none · subtle · hardNot every prop applies to every component — check the docs for per-component APIs.
tokens.css exposes CSS custom properties for colors (OKLCH palettes), typography, radii and shadows. Light and dark modes are built in and toggled via the data-theme attribute or the ModeToggle component.
To customize the theme, override the CSS variables in your own stylesheet after importing tokens.css:
:root {
--sk-accent-hue: 260;
--sk-radius-md: 8px;
}
Two utilities are exported for building custom components that integrate with the variant system:
import { createVariant } from '@abhc/spektral-ui';
import type { PatternPreset } from '@abhc/spektral-ui';
createVariant(config) — resolves a set of prop values to a class string using a declarative config object. Used internally by every component.PatternPreset — type for the SVG pattern presets available in Hero, TileGrid and Footer: scallops · grid · sunburst · lozenge · sunrise · atoms · waves · diamonds · shippo · kumi_kikko.Color conversion helpers are also exported for working with the OKLCH color space:
import { hexToOklch, oklchToHex, hexToRgbChannels } from '@abhc/spektral-ui';
import type { Oklch } from '@abhc/spektral-ui';
hexToOklch(hex) — converts a hex color string to an Oklch object { l, c, h }.oklchToHex(l, c, h) — converts OKLCH channels back to a hex string, with automatic gamut clamping.hexToRgbChannels(hex) — returns the RGB channels as a comma-separated string (e.g. "255, 128, 0"), useful for CSS rgb() / rgba() variables.All component prop types are also exported from the main entry point, so you never need to reach into dist/ internals:
// Data shapes (passed as arrays / objects to components)
import type { CommandItem, CommandGroup } from '@abhc/spektral-ui';
import type { BadgeItem } from '@abhc/spektral-ui';
import type { Swatch } from '@abhc/spektral-ui';
import type { Tile, TileMedia } from '@abhc/spektral-ui';
import type { Columns, HeroSpan } from '@abhc/spektral-ui';
// Prop union types (palette, direction, size…)
import type { Elevation } from '@abhc/spektral-ui';
import type { PopoverPalette, PopoverElevation,
PopoverDirection, PopoverAlign } from '@abhc/spektral-ui';
import type { SearchFieldSize, SearchFieldPalette } from '@abhc/spektral-ui';
import type { TooltipPalette, TooltipElevation,
TooltipDirection, TooltipAlign, TooltipSize } from '@abhc/spektral-ui';
import type { TimelineVariant, TimelinePalette, TimelineSize,
TimelineElevation, TimelineOrientation,
TimelineConnectorStyle } from '@abhc/spektral-ui';
^5.0.0:has, color-mix)Full docs, component API, live examples and theming guide: spektral.combe.tf
GPL-3.0 — see LICENSE.