# Welcome to the DÁP design system component library

This web component library is designed to be used with any frontend framework and is based on custom webcomponents with [litJS](https://lit.dev/).

[Documentation](https://services.gov.hu/design-system-dev/)

## Quick start

To get started with the DÁP Design System, follow these steps:

Install the library using your preferred package manager or load it directly from a CDN:

Package manager [(npm)](https://www.npmjs.com/package/dap-design-system)

```bash
npm install dap-design-system

yarn add dap-design-system

pnpm add dap-design-system
```

CDN

```html
<script type="module" src="https://cdn.jsdelivr.net/npm/dap-design-system" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dap-design-system/dist/light.theme.css" />
```

Start using the components in your application:

   ```jsx
   <dap-ds-button>My first button!</dap-ds-button>
   ```

That's it! You're now ready to start building beautiful web applications with the DÁP Design System Component Library.

## Importing Components

The design system supports multiple import strategies for optimal bundle sizes:

### Tree-Shakeable Imports (Recommended)

Import only the components you need to minimize bundle size:

```javascript
// Import components (excludes icons - saves ~130KB)
import { DapDSButton, DapDSInput } from 'dap-design-system/components'

// Import icons separately when needed (excludes components - saves ~1MB)
import { SystemAddLine, ArrowsArrowDownLine } from 'dap-design-system/icons'

// Import React wrappers
import { DapDSButton } from 'dap-design-system/react'
```

### Full Bundle Import (Backward Compatible)

Import everything (components + icons):

```javascript
// Imports all components and icons (~1.1MB total)
import { DapDSButton, SystemAddLine } from 'dap-design-system'
```

**Bundle Sizes:**
- **Main entry**: ~9KB (re-exports components and icons)
- **Components**: ~1MB (all components without icons)
- **Icons**: ~130KB (all icons without components)
- **React wrappers**: ~38KB

Using the tree-shakeable imports (`/components` and `/icons`) allows modern bundlers to optimize your final bundle size based on what you actually use.

## Benefits of web components

Web components are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. Custom components and widgets build on the Web Component standards, will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.

[Custom elements](https://html.spec.whatwg.org/multipage/custom-elements.html) in HTML are a way to define your own elements along with their behavior. You can use custom elements to create reusable components that can be used in web pages and web apps.
Read more about web components [here](https://developer.mozilla.org/en-US/docs/Web/Web_Components).

Web components are supported by all modern browsers, including Chrome, Firefox, Safari, and Edge. For more information on browser support, see [Can I Use](https://caniuse.com/custom-elementsv1).

## Architecture

The DÁP Design System Component Library is built using the following technologies and libraries:

- Components are built with [litJS](https://lit.dev/)
- Component metadata is generated by the [Custom Elements Manifest Analyzer](https://github.com/open-wc/custom-elements-manifest)
- Icons are from the [Remix icons](https://remixicon.com/) library
- Positioning of dropdowns, tooltips is handled by [Floating UI](https://floating-ui.com/)
- CDN hosting is provided by [jsDelivr](https://www.jsdelivr.com/)
- Development and production tooling is provided by [Vite](https://vitejs.dev/)
- [Storybook](https://storybook.js.org/) is used for component development and documentation
- [Sass](https://sass-lang.com/) CSS preprocessor is used for styling
- No styling framework is used, all styles are custom
