You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Never bypass the hook** unless you know exactly what you are doing—registry files must stay aligned with the source.
81
82
- If you run into issues during development you can run the same scripts manually to diagnose problems.
82
83
83
84
## Component Architecture
84
85
85
-
All distributable components live in `app/components/ui`. A typical component folder looks like this:
86
-
87
-
```
88
-
button/
89
-
├── button.tsx // main component implementation
90
-
├── button-demos.tsx // small interactive snippets used in docs
91
-
└── index.ts // re-export surface
92
-
```
86
+
All distributable components live in `registry/ui` with component demos in `demos/`
93
87
94
88
Key conventions:
95
89
96
90
-**Client components**: Most UI elements opt into the React Client Component model (`'use client';`) because they rely on interactivity or hooks from `@ariakit/react`.
97
91
-**Accessible primitives**: Wrap primitives from `@ariakit/react` (dialogs, tooltips, tabs, etc.). Follow their accessibility contract and expose ergonomic props on top.
98
92
-**Variants & styling**: Use `class-variance-authority` (`cva`) alongside the `cn` helper (`lib/utils.ts`) to express visual variants. Token-aware Tailwind utility classes (`bg-card`, `text-foreground`, `shadow-lg`, etc.) ensure consistent styling.
99
-
-**Exports**: `index.ts` should export every symbol that CLI consumers need, including demos that power documentation.
100
93
-**Demos**: Keep `*-demos.tsx` small and focused. They render within documentation pages and help both design and a11y reviews.
101
94
102
95
When adding or refactoring components:
@@ -132,8 +125,8 @@ The Nocta CLI fetches everything it needs from `public/registry`:
132
125
133
126
`scripts/build-components.sh` controls the JSON artefact:
134
127
135
-
1. Collects every `.tsx` file under `app/components/ui/**` (excluding `*-demos.tsx`).
136
-
2. Applies a Perl-based fix so icon imports (`@/app/components/ui/icons/icons`) are rewritten to the flat components structure that CLI writtes in.
128
+
1. Collects every `.tsx` file under `registry/ui/**`.
129
+
2. Applies a Perl-based fix so imports (`@/registry/ui/[componentName]`) are rewritten to (`@/components/ui/[componentName]`)n.
137
130
3. Base64-encodes the content and writes the map.
138
131
139
132
Whenever you add, rename, or delete components, run this script (or rely on the pre-commit hook) so the CLI stays in sync.
@@ -153,11 +146,11 @@ Component docs live in `content/docs`. Each component usually has an MDX file at
153
146
When introducing a new component:
154
147
155
148
1. Add or update the MDX documentation under `content/docs`. Use the existing pages as references for structure and tone.
156
-
2. Import your demo components from `app/components/ui/<component>/<component>-demos.tsx`.
149
+
2. Import your demo components from `demos/`.
157
150
3. Register the documentation page in `content/docs/meta.json` under the appropriate category heading (e.g. `"---Form---"`). This controls sidebar grouping.
158
151
4. Run `pnpm dev` and verify the documentation renders correctly.
159
152
160
-
> Remember to keep `mdx-components.tsx`, `content/docs/meta.json`, and `public/registry/registry.json` aligned so the docs, CLI, and registry all agree on the new component’s name and category.
153
+
> Remember to keep `content/docs/meta.json`, and `public/registry/registry.json` aligned so the CLI, and registry all agree on the new component’s name and category.
161
154
162
155
## Accessibility (a11y) Expectations
163
156
@@ -176,8 +169,8 @@ Accessibility is a core value of the library. Follow these practices:
176
169
Before opening a PR, please:
177
170
178
171
1. Run `pnpm lint` and ensure Biome passes.
179
-
2. Run `pnpm typecheck` and `pnpm typecheck:ui`.
180
-
3. Run (or rely on pre-commit to run) `scripts/sync-css-tokens.sh` and`scripts/build-components.sh` if you touched tokens or components.
172
+
2. Run `pnpm typecheck``.
173
+
3. Run (or rely on pre-commit to run) `scripts/sync-css-tokens.sh`, `scripts/sync-css-icons.sh``scripts/build-components.sh` if you touched tokens, icons or components.
181
174
4. Manually verify a11y-critical interactions in the docs site (keyboard + screen reader spot checks).
182
175
5. Update or add MDX docs and demos where relevant.
183
176
6. Include screenshots or GIFs in the PR description when visual changes are significant.
0 commit comments