A modern, accessible Svelte component library inspired by the NHS UK Design System, built with Svelte 5, TypeScript, Tailwind CSS v4, and DaisyUI v5.
One of three variations:
This project converts NHS UK Design System components into reusable Svelte 5 components styled with Tailwind CSS utility classes and DaisyUI component classes. It is intended to serve as a foundation for public good web applications that need accessible, well-structured UI components.
$props, $state, $derived, $bindable)git clone <repository-url>
cd public-good-design-system-nhs-uk-svelte-tailwind-daisyui
npm install
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build locally
npm run check # Run TypeScript and Svelte checks
All components are available as Svelte 5 components with TypeScript props interfaces.
| Component | Description |
|---|---|
| Button | Primary, secondary, and warning button variants |
| CharacterCount | Textarea with character/word count and threshold warnings |
| Checkboxes | Checkbox group with conditional reveal support |
| DateInput | Day/month/year date input fields |
| ErrorMessage | Inline error message for form fields |
| ErrorSummary | Summary of form errors with anchor links |
| Fieldset | Groups related form fields with legend |
| Hint | Help text for form fields |
| Input | Text input with prefix/suffix and width support |
| Label | Accessible form label with page heading option |
| Radios | Radio group with conditional reveal and dividers |
| Select | Dropdown select with option groups |
| Textarea | Multi-line text input with rows/cols support |
| Component | Description |
|---|---|
| ActionLink | Call-to-action link with arrow icon |
| BackLink | "Go back" navigation link |
| Breadcrumb | Breadcrumb trail navigation |
| ContentsList | Table of contents with anchor links |
| Footer | Page footer with navigation links and copyright |
| Header | Site header with logo, navigation, and search |
| Pagination | Previous/next page navigation |
| SkipLink | Accessibility skip-to-content link |
| Component | Description |
|---|---|
| Card | Content card with heading, description, image, and clickable variants |
| Details | Expandable disclosure widget |
| DoDontList | Side-by-side do/don't guidance lists |
| Hero | Full-width hero banner with actions and background image |
| Images | Responsive image with caption |
| InsetText | Visually indented block of text |
| NotificationBanner | Alert banner for success, info, or warning messages |
| Panel | Confirmation or highlight panel |
| SummaryList | Key-value summary with optional actions |
| Tables | Data table with responsive header and caption |
| Tabs | Tabbed content with keyboard navigation |
| Tag | Status badge/tag with colour variants |
| TaskList | Task list with status indicators |
| WarningCallout | Warning callout box with heading |
src/
app.css # Tailwind + DaisyUI theme configuration
app.html # HTML shell
lib/
index.ts # Library entry point (re-exports)
types.ts # TypeScript interfaces for all components
components/
index.ts # Component barrel exports
action-link/ # Each component in its own directory
back-link/
breadcrumb/
button/
...
routes/
+layout.svelte # Root layout
+page.svelte # Home page
components/+page.svelte # Component showcase/demo page
<script>
import { Button, Card, Header } from '$lib/components';
</script>
<Header
logoText="My Service"
showNavigation={true}
navigationItems={[
{ text: 'Home', href: '/' },
{ text: 'About', href: '/about' }
]}
/>
<Card
heading="Welcome"
description="This is a card component."
href="/details"
/>
<Button variant="primary">Save and continue</Button>
The design system uses a custom DaisyUI theme named "public-good" defined in src/app.css. Theme colours are configured using oklch colour space for perceptual uniformity:
oklch(68.47% 0.1479 237.32))To customise the theme, edit the @plugin "daisyui/theme" block in src/app.css.
Components follow WCAG AA guidelines:
aria-describedby linking for hints and error messages| File | Purpose |
|---|---|
package.json |
Dependencies and scripts |
svelte.config.js |
SvelteKit configuration with adapter-auto |
vite.config.ts |
Vite build configuration |
postcss.config.js |
PostCSS with @tailwindcss/postcss |
tsconfig.json |
TypeScript strict configuration |
src/app.css |
Tailwind CSS + DaisyUI theme |
MIT License