@twoux/ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +212 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ <div align="center">
2
+
3
+ <img src="https://raw.githubusercontent.com/axdexpert/twoux/main/.github/assets/banner.png?v=2" alt="The TwoUX wordmark surrounded by TwoUX components: keyboard settings, a stat card, a twoux find command, status badges, a list table with two rows selected, the assistant composer and a suggested-changes proposal" width="100%">
4
+
5
+ # TwoUX
6
+
7
+ TwoUX is an engineering-first design system for complex apps that makes UI and UX decisions explicit<br>
8
+ for engineers and AI agents, and enforces quality before inconsistent experiences reach production.
9
+
10
+ **Currently in Beta** · Built on [shadcn/ui](https://ui.shadcn.com) and [Radix](https://www.radix-ui.com), for [React 19+](https://react.dev) and [Tailwind CSS v4](https://tailwindcss.com)
11
+
12
+ <a href="https://www.npmjs.com/package/@twoux/ui"><img alt="npm version" src="https://img.shields.io/npm/v/@twoux/ui?label=npm&color=5753E0&logo=npm"></a>
13
+ <a href="https://github.com/axdexpert/twoux/blob/main/LICENSE.md"><img alt="Licence: free to use" src="https://img.shields.io/badge/licence-free_to_use-5753E0"></a>
14
+ <a href="#contributing"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen"></a>
15
+
16
+ <img alt="121 components" src="https://img.shields.io/badge/components-121-5753E0">
17
+ <img alt="46 patterns" src="https://img.shields.io/badge/patterns-46-5753E0">
18
+ <img alt="WCAG 2.2 AA" src="https://img.shields.io/badge/WCAG-2.2_AA-00704A">
19
+ <a href="#connect-over-mcp"><img alt="MCP server included" src="https://img.shields.io/badge/MCP-server_included-17171F"></a>
20
+
21
+ **[Quick start](#quick-start-with-your-agent)** · **[Rules for agents](https://github.com/axdexpert/twoux/blob/main/AGENTS.md)** · **[Every page](https://github.com/axdexpert/twoux/blob/main/llms.txt)** · **[Why TwoUX](#why-twoux)** · **[Contributing](#contributing)** · **[Licence](https://github.com/axdexpert/twoux/blob/main/LICENSE.md)**
22
+
23
+ </div>
24
+
25
+ ## Overview
26
+
27
+ Engineers now build UI through coding agents, often with no designer in the loop and no Figma file to check against. Design systems ship components, not decisions, so the agent picks the nearest piece and fills every gap with a guess. TwoUX writes those decisions down: which component fits which job, how a flow behaves, when to confirm and when to offer Undo, each grounded in published usability research, WCAG, WAI-ARIA and the design systems of major SaaS products.
28
+
29
+ It ships 121 compact, keyboard-first components for dense B2B apps, 122 jobs, 46 patterns, light and dark themes, a theme generator that checks contrast, a lint, an MCP server and agent skills as one system. People and AI agents read the same rules and get the same answers.
30
+
31
+ **What makes TwoUX different:**
32
+
33
+ - **Agent Experience on both sides.** The coding agent that builds the UI gets rules it can read and follow: `AGENTS.md`, `llms.txt`, a Markdown page per component and skills to build, audit and propose. The people who supervise agents inside the product get components for plans, approvals, run timelines and permissions.
34
+ - **A knowledge base, not a component list.** 122 jobs, each mapped to one component with what to use instead, and 46 patterns that walk through whole flows step by step. Every rule carries its reason and its numbered sources.
35
+ - **Complex, never complicated.** Dense tables, spreadsheet grids, charts and AI agent interfaces, compact and keyboard-first, in light and dark, with the right interactions, states and motion built in. WCAG 2.2 AA.
36
+ - **Guardrails over guidelines.** A lint for raw values and local copies, a Claude Code hook that blocks edits to the system, a browser audit for contrast, focus and spacing, and a theme file that refuses colours that fail WCAG.
37
+
38
+ ## Quick start with your agent
39
+
40
+ Paste this into Claude Code, Cursor, Codex or Copilot:
41
+
42
+ ```text
43
+ Set up the TwoUX design system in this project.
44
+ 1. Install @twoux/ui with this repo's package manager.
45
+ 2. Run `npx twoux init`, then read node_modules/@twoux/ui/agent/AGENTS.md.
46
+ 3. For every UI job, find the component with `npx twoux find "<job>"` (or the twoux MCP server's find_component tool) and read its page before writing code.
47
+ 4. Before you finish, run `npx twoux check` and fix every error.
48
+ ```
49
+
50
+ Then give it your brand:
51
+
52
+ ```text
53
+ Give this app our brand with TwoUX.
54
+ 1. Set primary, radius and font in twoux.theme.json to match our brand.
55
+ 2. Run `npx twoux theme`.
56
+ 3. Import ./twoux-theme.css after @twoux/ui/styles.css.
57
+ If the generator refuses a colour for contrast, use the closest colour it accepts and tell me which.
58
+ ```
59
+
60
+ ## Getting started
61
+
62
+ Requires React 19 and Tailwind CSS v4.
63
+
64
+ **1. Install**
65
+
66
+ ```bash
67
+ npm install @twoux/ui
68
+ # or
69
+ pnpm add @twoux/ui
70
+ # or
71
+ yarn add @twoux/ui
72
+ ```
73
+
74
+ **2. Set up your agents**
75
+
76
+ ```bash
77
+ npx twoux init
78
+ ```
79
+
80
+ This adds the TwoUX rules to `AGENTS.md` and `CLAUDE.md`, connects the MCP server, and adds the TwoUX skills, a guard hook and `twoux.theme.json`. It never overwrites a file; it adds to what is there.
81
+
82
+ **3. Import the styles and use a component**
83
+
84
+ ```tsx
85
+ import '@twoux/ui/styles.css';
86
+ import { Button, Toaster, toast } from '@twoux/ui';
87
+
88
+ export function App() {
89
+ return (
90
+ <>
91
+ <Button shortcut="C" onClick={() => toast.success('Listing created')}>
92
+ New listing
93
+ </Button>
94
+ <Toaster />
95
+ </>
96
+ );
97
+ }
98
+ ```
99
+
100
+ **4. Check before you merge**
101
+
102
+ ```bash
103
+ npx twoux check
104
+ ```
105
+
106
+ ## Connect over MCP
107
+
108
+ `npx twoux init` connects it for you. To add it by hand:
109
+
110
+ | Tool | Command or file |
111
+ | ----------- | --------------------------------------------------------------------------------------------------------------------------- |
112
+ | Claude Code | `claude mcp add twoux -- npx -y @twoux/ui mcp` |
113
+ | Codex | `codex mcp add twoux -- npx -y @twoux/ui mcp` |
114
+ | Cursor | `.cursor/mcp.json`: `{ "mcpServers": { "twoux": { "command": "npx", "args": ["-y", "@twoux/ui", "mcp"] } } }` |
115
+ | VS Code | `.vscode/mcp.json`: `{ "servers": { "twoux": { "type": "stdio", "command": "npx", "args": ["-y", "@twoux/ui", "mcp"] } } }` |
116
+
117
+ The server runs on your machine and reads only the installed package. Its tools: `find_component`, `get_doc`, `list_docs`, `get_rules` and `check`.
118
+
119
+ ## The twoux command
120
+
121
+ | Command | What it does |
122
+ | ------------------------ | --------------------------------------------------------------------------------- |
123
+ | `npx twoux init` | Sets up the project for AI agents. `--principles` for an app not built with TwoUX |
124
+ | `npx twoux find "<job>"` | Names the component or pattern for a job, how to use it and what not to use |
125
+ | `npx twoux docs [id]` | Lists every page, or prints one. `docs rules` prints every rule |
126
+ | `npx twoux check` | Lints app code against TwoUX's rules. Exits 1 on errors |
127
+ | `npx twoux theme` | Builds `twoux-theme.css` from `twoux.theme.json`, checking contrast |
128
+ | `npx twoux mcp` | Runs the MCP server |
129
+
130
+ ## Packages
131
+
132
+ | Package | Description |
133
+ | -------------------------- | ------------------------------------------------------------------------------- |
134
+ | [`@twoux/ui`](https://github.com/axdexpert/twoux/tree/main/packages/ui) | Components, tokens, styles, agent files, the `twoux` command and the MCP server |
135
+ | [`twoux`](https://github.com/axdexpert/twoux/tree/main/packages/twoux) | Runs `npx twoux` with the `@twoux/ui` installed in your project |
136
+
137
+ ## Why TwoUX
138
+
139
+ ### Building got faster and cheaper. So did inconsistency.
140
+
141
+ Building and shipping UI has never been faster or cheaper. Consistency didn't come with it. AI doesn't fix the mess, it scales it. Engineers build through coding agents, often with no designer in the loop and no Figma file to check against. But design systems ship components, not decisions. A button doesn't say when not to use it. So the agent picks the nearest piece and fills every gap with a guess.
142
+
143
+ Each guess looks fine on its own: a modal for record detail, a disabled submit, an error in a toast, a delete with no Undo. Together they turn one product into five. That debt shows up later as duplicated components, accessibility fixes and screens that each behave differently.
144
+
145
+ | | |
146
+ | ------ | ----------------------------------------------------------------------------- |
147
+ | **13** | engineers per designer in AI-company job postings¹ |
148
+ | **4×** | more cloned code since AI coding assistants² |
149
+ | **0** | rules on when not to use a dialog in the docs of popular component libraries³ |
150
+
151
+ <sub>¹ Applied Methods, analysis of 9,281 open roles at AI companies, 2026. ² GitClear, AI Copilot Code Quality 2025: 211M changed lines, 2020 to 2024. ³ Dialog pages of shadcn/ui and Radix, checked November 2026: API and examples, no guidance on when to use or avoid it.</sub>
152
+
153
+ The design systems out there weren't built for this. Most give you components, often basic ones, and stop there:
154
+
155
+ - **No Agent Experience.** Written for people browsing docs, not for an AI agent that needs rules it can read and follow.
156
+ - **Not built for complex B2B.** Buttons and cards, but not the dense tables, spreadsheet grids, dashboards and AI interfaces B2B products run on.
157
+ - **No logic, no UX.** What a component looks like, but not which job it's for, how the flow behaves, or when to confirm and when to offer Undo.
158
+ - **No guardrails.** Nothing stops an agent from inventing a grey, rebuilding a dropdown or shipping AI slop.
159
+
160
+ ### Nobody needs more components
161
+
162
+ Engineers and product teams don't need more components. They need what the best UX designers and the design systems of market-leading products already know, written down where every agent can read it and every check can enforce it.
163
+
164
+ TwoUX is a research-backed knowledge base built on UX expertise. It decides the UX, not only the look: which component fits which job, how a flow behaves, when to confirm and when to offer Undo. None of it is an LLM's opinion. Every decision is grounded in published usability research, WCAG, WAI-ARIA and the design systems of major SaaS products, and every component page explains its decisions with numbered sources.
165
+
166
+ ## Tested on real agents
167
+
168
+ Claude Opus, Sonnet and Haiku, given realistic developer requests in a TwoUX project and never told the rules, November 2026:
169
+
170
+ | Result | What it means |
171
+ | ------------ | --------------------------------------------------------------------------- |
172
+ | **0 of 14** | runs changed the design system without being asked |
173
+ | **10 of 10** | planted UX problems found by every model, including the 4 no linter can see |
174
+ | **3 of 3** | rebrands went through the theme file, not page-by-page overrides |
175
+
176
+ The four problems only the rules caught are the judgement calls a designer makes: a modal for record detail, a disabled submit, an error in a toast and a delete without Undo. When a developer insisted on editing a component directly, two of three models did, and `twoux check` caught both. Every failure became a new check.
177
+
178
+ ## Built by a UX engineer, for engineers and their agents
179
+
180
+ TwoUX stands on the shoulders of the brilliant minds behind every source it cites. I started from a decade of UX decisions I kept explaining in reviews, and the mistakes I kept fixing in agent-written UI, then researched how standards and mature SaaS design systems solve each one. Each answer became a rule, a job or a pattern step, with its source (611 links, all checked).
181
+
182
+ Components are generated from shadcn's untouched source by a script, so the API stays familiar to engineers and agents. The docs site and the agent files come from the same content, so people and agents get the same answer.
183
+
184
+ Giulia Pizzignacco, founder and UX engineer
185
+
186
+ ## Project structure
187
+
188
+ | Directory | Purpose |
189
+ | ----------------- | ------------------------------------------------------------------- |
190
+ | `apps/docs` | The docs site, with live examples and example apps |
191
+ | `apps/playground` | A sandbox app built only from TwoUX |
192
+ | `packages/ui` | The `@twoux/ui` package |
193
+ | `packages/twoux` | The `twoux` command package |
194
+ | `docs-md/` | One Markdown page per foundation, component and pattern, for agents |
195
+ | `scripts/` | Generators for the agent files, theme, palette and checks |
196
+
197
+ ## Contributing
198
+
199
+ Issues and pull requests are welcome. By sending one, you agree to the contribution terms in section 8 of the licence.
200
+
201
+ ```bash
202
+ corepack enable
203
+ pnpm install
204
+ pnpm dev # docs site on http://localhost:3100
205
+ pnpm verify # type check, interaction, responsive and design checks
206
+ ```
207
+
208
+ To report a security problem, follow [SECURITY.md](https://github.com/axdexpert/twoux/blob/main/SECURITY.md).
209
+
210
+ ## Licence
211
+
212
+ Free to use under the [TwoUX Licence](https://github.com/axdexpert/twoux/blob/main/LICENSE.md): build and ship any number of your own products with it, including commercial products and client work. Don't sell or republish TwoUX, or a modified copy, as a design system, UI kit, template or component library, and don't train models on it. Third-party notices are in [NOTICE.md](https://github.com/axdexpert/twoux/blob/main/NOTICE.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twoux/ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Engineering-first design system for complex apps. Makes UI and UX decisions explicit for engineers and AI agents.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",