# domestic-ui

domestic-ui is a CSS design system built on native HTML, custom properties and cascade layers. Link one stylesheet and semantic HTML is styled in light and dark, with WCAG 2.2 AA as the baseline. Theme it by overriding semantic tokens. It packages existing web standards and patterns. Nothing here is original.

## Install and use

Plain CSS, no build step. The current release is **0.1.0** ([release notes](https://github.com/odonckers/domestic-ui/releases/tag/v0.1.0), [changelog](https://domestic-ui.odonckers.dev/changelog.md)). Download the [v0.1.0 source archive](https://github.com/odonckers/domestic-ui/archive/refs/tags/v0.1.0.zip), copy its `css/` folder into your project and link the entry point:

```html
<link rel="stylesheet" href="css/domestic.css">
```

Imports are relative, so it works from any path. Paths under `css/` are public API ([Agent-friendly by design](https://domestic-ui.odonckers.dev/principles/agent-friendly-by-design.md)), versioned with [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Layer order

`css/domestic.css` declares the [cascade layers](https://domestic-ui.odonckers.dev/principles/cascade-layers.md), lowest priority first. Your unlayered CSS beats all of them.

```css
@layer reset, tokens, base, layout, components, utilities;
```

## Theming

Override semantic `--dui-*` tokens on `:root`, or on an element with `data-theme` ([Theming](https://domestic-ui.odonckers.dev/principles/theming.md), with a live example). Force a scheme with `data-color-scheme="light"` or `"dark"`.

## Component API

Each component exposes one `data-<component>` attribute. Its value is space-separated words matched with the [`~=` selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors), like [`rel`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel): `data-button="primary small"`. State uses native attributes and ARIA: `disabled`, `aria-disabled`, `aria-busy`, `aria-invalid`.

**Our choice:** One attribute is one API to learn, it reads as a sentence (`data-button="primary small"`), and it cannot pile up like modifier classes.

Layout primitives and utilities: `data-action-bar`, `.cluster`, `.grid`, `data-card`, `data-scroll`, `.stack`, `.visually-hidden`. Base elements need no API.

## How these docs are organized

The sidebar follows Brad Frost's [Atomic Design](https://atomicdesign.bradfrost.com/): [tokens](https://domestic-ui.odonckers.dev/tokens/index.md), then [base elements](https://domestic-ui.odonckers.dev/components/base.md) and [layouts](https://domestic-ui.odonckers.dev/layouts/index.md), then [atoms](https://domestic-ui.odonckers.dev/atoms/index.md), [molecules](https://domestic-ui.odonckers.dev/molecules/index.md) and [organisms](https://domestic-ui.odonckers.dev/organisms/index.md). [Patterns](https://domestic-ui.odonckers.dev/patterns/index.md) combine them, and [web components](https://domestic-ui.odonckers.dev/components/web-components.md) add the behavior HTML lacks. The [principles](https://domestic-ui.odonckers.dev/principles/index.md) explain each choice; [explainers](https://domestic-ui.odonckers.dev/explainers/index.md) cover the patterns no standard does.

## For coding agents

[llms.txt](https://domestic-ui.odonckers.dev/llms.txt) ([format](https://llmstxt.org/)) indexes these docs; [llms-full.txt](https://domestic-ui.odonckers.dev/llms-full.txt) has every page. Each page has a Markdown twin: same path, `.md`.
