Skip to content

benediktgrether/ds-web-components

Repository files navigation

🧩 DS Web Components

A modern Design System built with Lit, Tailwind CSS, and Storybook. This project uses Vite for fast builds and supports component-based development using Web Components.


📦 Project Structure

├── src
│   ├── components
│   │   ├── button
│   │   ├── headline
│   │   └── image
│   ├── layout
│   │   └── container
│   ├── css
│   │   ├── config
│   │   └── main.css
│   ├── index.ts
│   └── vite-env.d.ts

🚀 Getting Started

1. Install dependencies

pnpm install

2. Start development server

pnpm run dev

3. Open Storybook

pnpm run storybook

4. Build for production

pnpm run build

5. Build Storybook

pnpm run build-storybook

🛠️ Technologies Used


🧱 Example Components

ds-headline

<ds-headline level="h2" size="large">
    Hello World
</ds-headline>

Supports dynamic heading levels and sizes using Tailwind classes.

ds-button

<ds-button variant="primary">Click Me</ds-button>
<ds-button variant="secondary">Cancel</ds-button>

Variants styled using Tailwind classes and customizable via props.


✏️ Custom Styling

CSS is organized under src/css/:

  • main.css: Core utilities and Tailwind layer.
  • config/colors.css: Custom color definitions.

🧪 Storybook & Chromatic

Storybook stories are colocated with components (*.stories.ts). You can run visual regression tests and publish stories with Chromatic.


📁 Aliases

You can import your CSS using aliases like:

import style from '@css/main.css';

Make sure your vite.config.ts defines the correct path aliases.


📚 Conventions

  • Each component exports from an index.ts file.
  • Web components are defined using @customElement.
  • Shared styles are managed using unsafeCSS.

🔧 Scripts

Script Description
pnpm run dev Start Vite dev server
pnpm run build Build project with TypeScript
pnpm run preview Preview built app with Vite
pnpm run storybook Start Storybook in dev mode
pnpm run build-storybook Build static Storybook site

📄 License

MIT — Feel free to use and adapt.


👤 Author

Benedikt Grether
📧 info@benediktgrether.de
🌐 benediktgrether.de

Releases

No releases published

Packages

 
 
 

Contributors