@codenhub/styles 0.6.0 → 0.7.0

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 (113) hide show
  1. package/NOTICE +18 -16
  2. package/README.es.md +61 -0
  3. package/README.md +21 -16
  4. package/README.pt-BR.md +61 -0
  5. package/dist/aesthetics/chunky-tile.css +1 -1
  6. package/dist/aesthetics/cyber.css +1 -1
  7. package/dist/aesthetics/glass.css +1 -1
  8. package/dist/aesthetics/index.css +2 -2
  9. package/dist/aesthetics/neobrutalism.css +1 -1
  10. package/dist/aesthetics/pixel.css +1 -1
  11. package/dist/aesthetics/sketch.css +1 -1
  12. package/dist/components.css +2 -2
  13. package/dist/index.css +2 -2
  14. package/dist/native.css +2 -2
  15. package/dist/palette.css +1 -1
  16. package/dist/theme.css +2 -2
  17. package/dist/tw/aesthetics/chunky-tile.css +81 -23
  18. package/dist/tw/aesthetics/cyber.css +86 -29
  19. package/dist/tw/aesthetics/glass.css +177 -50
  20. package/dist/tw/aesthetics/neobrutalism.css +98 -22
  21. package/dist/tw/aesthetics/pixel.css +93 -8
  22. package/dist/tw/aesthetics/sketch.css +87 -22
  23. package/dist/tw/box.css +21 -2
  24. package/dist/tw/components/feedback.css +2 -2
  25. package/dist/tw/components/form.css +58 -19
  26. package/dist/tw/components/index.css +3 -4
  27. package/dist/tw/components/surface.css +15 -6
  28. package/dist/tw/index.css +1 -1
  29. package/dist/tw/intent.css +6 -5
  30. package/dist/tw/native.css +8 -8
  31. package/dist/tw/palette.css +6 -6
  32. package/dist/tw/reset.css +15 -15
  33. package/dist/tw/theme.css +29 -17
  34. package/dist/tw/utilities/content.css +43 -1
  35. package/dist/tw/utilities/layout.css +26 -12
  36. package/docs/accessibility.md +89 -60
  37. package/docs/changelog/0.1.1.md +1 -0
  38. package/docs/changelog/0.2.0.md +1 -0
  39. package/docs/changelog/0.3.0.md +1 -0
  40. package/docs/changelog/0.4.0.md +1 -0
  41. package/docs/changelog/0.5.0.md +8 -3
  42. package/docs/changelog/0.6.0.md +2 -1
  43. package/docs/changelog/0.7.0.md +50 -0
  44. package/docs/changelog/index.md +1 -0
  45. package/docs/concepts.md +188 -46
  46. package/docs/es/accessibility.md +150 -0
  47. package/docs/es/concepts.md +212 -0
  48. package/docs/es/index.md +104 -0
  49. package/docs/es/integrating/astro.md +35 -0
  50. package/docs/es/integrating/index.md +47 -0
  51. package/docs/es/integrating/nextjs.md +67 -0
  52. package/docs/es/integrating/svelte.md +45 -0
  53. package/docs/es/integrating/tailwind.md +78 -0
  54. package/docs/es/integrating/vue.md +31 -0
  55. package/docs/es/integrating/without-a-bundler.md +115 -0
  56. package/docs/es/setup.md +180 -0
  57. package/docs/es/usage/aesthetics.md +276 -0
  58. package/docs/es/usage/buttons.md +131 -0
  59. package/docs/es/usage/composing.md +164 -0
  60. package/docs/es/usage/content-and-layout.md +215 -0
  61. package/docs/es/usage/customizing.md +298 -0
  62. package/docs/es/usage/feedback.md +153 -0
  63. package/docs/es/usage/forms.md +231 -0
  64. package/docs/es/usage/index.md +29 -0
  65. package/docs/es/usage/solo.md +84 -0
  66. package/docs/es/usage/theming.md +296 -0
  67. package/docs/es/usage/tooltips.md +127 -0
  68. package/docs/index.md +85 -26
  69. package/docs/integrating/astro.md +3 -4
  70. package/docs/integrating/index.md +18 -13
  71. package/docs/integrating/nextjs.md +3 -4
  72. package/docs/integrating/svelte.md +5 -4
  73. package/docs/integrating/tailwind.md +16 -3
  74. package/docs/integrating/vue.md +3 -4
  75. package/docs/integrating/without-a-bundler.md +114 -0
  76. package/docs/pt-BR/accessibility.md +150 -0
  77. package/docs/pt-BR/concepts.md +212 -0
  78. package/docs/pt-BR/index.md +104 -0
  79. package/docs/pt-BR/integrating/astro.md +35 -0
  80. package/docs/pt-BR/integrating/index.md +47 -0
  81. package/docs/pt-BR/integrating/nextjs.md +67 -0
  82. package/docs/pt-BR/integrating/svelte.md +45 -0
  83. package/docs/pt-BR/integrating/tailwind.md +78 -0
  84. package/docs/pt-BR/integrating/vue.md +31 -0
  85. package/docs/pt-BR/integrating/without-a-bundler.md +115 -0
  86. package/docs/pt-BR/setup.md +180 -0
  87. package/docs/pt-BR/usage/aesthetics.md +276 -0
  88. package/docs/pt-BR/usage/buttons.md +131 -0
  89. package/docs/pt-BR/usage/composing.md +164 -0
  90. package/docs/pt-BR/usage/content-and-layout.md +215 -0
  91. package/docs/pt-BR/usage/customizing.md +298 -0
  92. package/docs/pt-BR/usage/feedback.md +153 -0
  93. package/docs/pt-BR/usage/forms.md +231 -0
  94. package/docs/pt-BR/usage/index.md +29 -0
  95. package/docs/pt-BR/usage/solo.md +84 -0
  96. package/docs/pt-BR/usage/theming.md +296 -0
  97. package/docs/pt-BR/usage/tooltips.md +127 -0
  98. package/docs/setup.md +134 -91
  99. package/docs/usage/aesthetics.md +76 -66
  100. package/docs/usage/buttons.md +108 -40
  101. package/docs/usage/composing.md +105 -92
  102. package/docs/usage/content-and-layout.md +157 -126
  103. package/docs/usage/customizing.md +107 -37
  104. package/docs/usage/feedback.md +134 -71
  105. package/docs/usage/forms.md +176 -107
  106. package/docs/usage/index.md +18 -14
  107. package/docs/usage/solo.md +83 -0
  108. package/docs/usage/theming.md +260 -118
  109. package/docs/usage/tooltips.md +90 -49
  110. package/llms-full.txt +2358 -1313
  111. package/llms.txt +24 -22
  112. package/package.json +25 -32
  113. package/dist/tw/components/loader.css +0 -116
package/docs/setup.md CHANGED
@@ -1,136 +1,179 @@
1
1
  ---
2
2
  title: Setup
3
- description: Install the package, pick an entrypoint, and render a first component.
3
+ description: Install the package, choose compiled CSS or Tailwind source, and render the settings page shell.
4
4
  order: 1
5
5
  ---
6
6
 
7
7
  # Setup
8
8
 
9
- ## Installation
9
+ This page gets the stylesheet into your project and puts the empty shell of the settings screen on the page. It takes one install, one import, and one choice: compiled CSS or Tailwind source. The rest of the page is reference you can come back to: every entrypoint, the classless option, the cascade layers, and what goes wrong when an import is missing.
10
+
11
+ ## Install
10
12
 
11
13
  ```sh
12
14
  pnpm add @codenhub/styles
13
15
  ```
14
16
 
15
- ## Quick start
17
+ `npm install @codenhub/styles` and `yarn add @codenhub/styles` work the same way.
18
+
19
+ ## Import the stylesheet
16
20
 
17
- Import the compiled stylesheet for the complete token, reset, utility, and component-class surface, then compose helper classes in markup:
21
+ Import the complete compiled stylesheet once, in the CSS file your app already loads globally:
18
22
 
19
23
  ```css
20
24
  @import "@codenhub/styles";
21
25
  ```
22
26
 
27
+ Then write the shell of the settings screen. It is a page section with a centered, narrow column:
28
+
23
29
  ```html
24
- <main class="stack">
25
- <p class="text-label">Status</p>
26
- <h1 class="text-title">Ready to publish</h1>
27
- <button class="btn primary">Continue</button>
30
+ <main class="section">
31
+ <div class="section-content narrow stack">
32
+ <h1 class="text-title">Account settings</h1>
33
+ <p>Manage your profile, plan, and security.</p>
34
+ </div>
28
35
  </main>
29
36
  ```
30
37
 
31
- The full stylesheet applies global reset and focus-visible rules, but does not apply the optional classless native-element mappings, and does not include aesthetics. Import focused entrypoints when global rules are not appropriate; see [Import paths](#import-paths) below.
38
+ If the heading renders in a bold, tight title face with the paragraph spaced below it, and the column sits in the middle of a wide window, the stylesheet is working. If it looks like unstyled browser defaults, see [When nothing is styled](#when-nothing-is-styled).
32
39
 
33
- Aesthetics are opt-in. Import the combined aesthetics stylesheet, or one aesthetic on its own. Order does not matter, because every entrypoint declares the [cascade layers](#cascade-layers) before it uses one:
40
+ The complete stylesheet includes the reset, the tokens, the layout and type helpers, and every component class. It applies global rules to your page: the reset, the root theme, and focus rings. It does not include the aesthetics or the classless element mappings; both are separate imports, described below.
34
41
 
35
- ```css
36
- @import "@codenhub/styles";
37
- @import "@codenhub/styles/aesthetics";
38
- ```
42
+ ## Choose your route
39
43
 
40
- ```html
41
- <section class="neobrutalism">
42
- <button class="btn primary">Thick ink and a hard shadow</button>
43
- </section>
44
- ```
44
+ Pick one:
45
45
 
46
- A project already running Tailwind CSS v4 imports the source entrypoint instead; see [Integrating → Tailwind CSS v4](./integrating/tailwind.md).
46
+ - **Compiled CSS** (`@codenhub/styles`, shown above). Use it unless you have a reason not to. Any bundler that resolves CSS imports from packages works, such as Vite, webpack, or the Tailwind CLI.
47
+ - **Tailwind CSS v4 source** (`@codenhub/styles/tw`). Use it when your project already runs Tailwind v4. Your build compiles the package with your own utilities, so you get one stylesheet and Tailwind's `dark:` variant matches the package's theme. It needs Tailwind 4.3.2 or newer, below 5.
48
+ - **No bundler.** Link the compiled file from `node_modules` or a CDN with a `<link>` tag.
47
49
 
48
- ## Configuration
50
+ Your framework may need its own wiring, such as where the global stylesheet goes in Next.js or Astro. Each of these guides covers one setup and then sends you back here:
49
51
 
50
- The root follows the operating-system color-scheme preference. Apply `.light` or `.dark` to the root or any ancestor to force token values for that subtree. `.theme-light`, `.theme-dark`, and `data-theme="light|dark"` are aliases.
52
+ - [Tailwind CSS v4](./integrating/tailwind.md)
53
+ - [Next.js](./integrating/nextjs.md)
54
+ - [Vue](./integrating/vue.md)
55
+ - [Svelte](./integrating/svelte.md)
56
+ - [Astro](./integrating/astro.md)
57
+ - [Without a bundler](./integrating/without-a-bundler.md)
51
58
 
52
- ```html
53
- <html class="dark">
54
- <body>
55
- <button class="btn primary">Dark themed button</button>
56
- </body>
57
- </html>
59
+ ## Add an aesthetic (optional)
60
+
61
+ Aesthetics are separate stylesheets because most pages use one or none. Import all six at once, or only the one you use:
62
+
63
+ ```css
64
+ @import "@codenhub/styles";
65
+ @import "@codenhub/styles/aesthetics/neobrutalism";
58
66
  ```
59
67
 
60
- See [Concepts → Theme selection](./concepts.md#theme-selection) for how selectors resolve and [Usage → Theming](./usage/theming.md) for the full color token reference.
68
+ The order of the two imports does not matter, because every entrypoint declares the [cascade layers](#cascade-layers) before using one. [Aesthetics](./usage/aesthetics.md) shows what each one does; you can skip them until then.
61
69
 
62
- ### Dark variant
70
+ ## Requirements
63
71
 
64
- `/tw` source entrypoints define a custom `dark:` variant for your own utilities. It fires under an explicit dark selector (`.dark`, `.theme-dark`, or `[data-theme="dark"]`, on the element or an ancestor), or under the system preference when nothing under it forces a theme explicitly:
72
+ - **Browsers:** Chrome 123, Safari 17.5, or Firefox 128 and newer. Colors use `light-dark()` and `color-scheme` (Firefox 120). `.input-group` reads a nested control's invalid and disabled state with `:has()` (Firefox 121). The elevation classes register a non-inheriting property with `@property` (Firefox 128); without it, an elevation class would also reach the unclassed elements inside it.
73
+ - **Tooling:** an `@import` of a package name needs a tool that resolves CSS imports from packages. Without one, link the compiled file by its path or from a CDN; see [Without a bundler](./integrating/without-a-bundler.md).
74
+ - **Tailwind:** 4.3.2 or newer, below 5, only for the `/tw` source entrypoints. It is an optional peer dependency, so the compiled entrypoints do not install it.
75
+ - **Your application:** the package has no JavaScript. Semantic HTML, ARIA, keyboard behavior, focus management, validation, and announcements are yours; see [Accessibility](./accessibility.md).
76
+
77
+ ## When nothing is styled
78
+
79
+ - **The import is missing or not loaded globally.** The classes do nothing until the stylesheet is on the page. Import it once in a stylesheet every page loads, not in a component that may not render.
80
+ - **The package name does not resolve.** A plain `<link>` or a tool without CSS package resolution cannot read `@import "@codenhub/styles"`. Link `node_modules/@codenhub/styles/dist/index.css`, or follow [Without a bundler](./integrating/without-a-bundler.md).
81
+ - **A `/tw` path is loaded without Tailwind.** The `/tw` files are Tailwind source: they contain `@theme`, `@utility`, and `@apply`, which browsers do not understand. Your Tailwind build has to compile them; see [Tailwind CSS v4](./integrating/tailwind.md).
82
+ - **A class built at runtime is missing (Tailwind source only).** Tailwind generates a class only when it finds the name in your source files. A name assembled from strings, such as `` `btn ${tone}` ``, is invisible to that scan. Write full class names, or list them as described in [Tailwind CSS v4](./integrating/tailwind.md).
83
+
84
+ ### Inlining critical CSS
85
+
86
+ You can paste a **compiled** stylesheet, from `dist/` or from your own build output, into an HTML `<style>` element, for example to inline critical CSS in a server-rendered head. None of the compiled files contains the `</style` sequence that would end the element early.
87
+
88
+ That does not apply to the `/tw` files. They are Tailwind source, not finished CSS, so pasting one into `<style>` gives the browser directives it ignores and the classes are never generated. Compile them with Tailwind first, then inline the output.
89
+
90
+ ## All entrypoints
91
+
92
+ Compiled entrypoints are finished CSS. `/tw` entrypoints publish the uncompiled source from `dist/tw`, which a Tailwind v4 build must process. A focused `/tw` component entrypoint includes the theme tokens, so its classes work on their own.
93
+
94
+ Each import path resolves the same file under the `style`, `import`, and `default` export conditions. A CSS import is a side effect, so make sure your bundler does not drop it as unused.
95
+
96
+ | Import path | What it contains and what it changes |
97
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
98
+ | `@codenhub/styles` | Compiled complete stylesheet: Tailwind's base and theme output, tokens, typography, layout and content helpers, components, and the reset. Applies the global reset, root theme, and focus rules. |
99
+ | `@codenhub/styles/theme` | Compiled tokens and the intent, presentation, elevation, and corner-pattern classes. Sets root theme properties and the light and dark selectors. No reset and no components. |
100
+ | `@codenhub/styles/palette` | Generated `--palette-*` custom properties: every intent and presentation combination's fill, text, and border color as a flat value, plus flat `border`, `surface`, and `text` colors. For code that cannot use the package itself; see [Customizing → Generated palette](./usage/customizing.md#generated-palette). |
101
+ | `@codenhub/styles/components` | Compiled tokens, typography helpers, and every component class. Each component carries its own reduced-motion rule, and the closed-`<dialog>` fix comes with `.card`. No reset, no layout or content helpers, no classless mappings. |
102
+ | `@codenhub/styles/native` | The complete compiled stylesheet plus [classless mappings](#classless-html) for plain HTML elements. Applies the reset and broad element selectors. |
103
+ | `@codenhub/styles/aesthetics` | All six compiled aesthetics, `.neobrutalism`, `.glass`, `.pixel`, `.chunky-tile`, `.cyber`, and `.sketch`, each with its `-solo` class. No tokens or components of its own; import it in any order. |
104
+ | `@codenhub/styles/aesthetics/*` | One compiled aesthetic and its solo class: `/neobrutalism`, `/glass`, `/pixel`, `/chunky-tile`, `/cyber`, or `/sketch`. |
105
+ | `@codenhub/styles/tw` | Source version of the complete stylesheet. Imports Tailwind itself, then the theme, typography, helpers, components, and reset. Same global rules. |
106
+ | `@codenhub/styles/tw/theme` | Source theme, tokens, and axis classes. Imports Tailwind's theme layer, emits the theme selectors, and defines the package's `dark:` variant. |
107
+ | `@codenhub/styles/tw/components` | Source theme, typography, buttons, feedback, forms, surfaces, and tooltips. No reset, no layout or content helpers, no classless mappings. |
108
+ | `@codenhub/styles/tw/surface` | Source theme plus `.surface`, `.card`, and `.panel`. |
109
+ | `@codenhub/styles/tw/button` | Source theme plus `.btn`. |
110
+ | `@codenhub/styles/tw/form` | Source theme plus `.field`, `.text-control`, `.ipt`, `.textarea`, `.select`, `.input-group`, `.checkbox`, `.radio`, and `.switch`. |
111
+ | `@codenhub/styles/tw/feedback` | Source theme plus `.alert`, `.badge`, `.skeleton`, and `.progress`, with their animations. |
112
+ | `@codenhub/styles/tw/tooltip` | Source theme plus the tooltip classes. |
113
+ | `@codenhub/styles/tw/reset` | Source theme, typography helpers, and the global reset. Changes the root, body, and elements, and sets selection, motion, focus, scrollbar, and forced-colors rules. |
114
+ | `@codenhub/styles/tw/native` | Source version of `/native`: everything plus the reset and the classless mappings. The broadest global effect. |
115
+ | `@codenhub/styles/tw/typography` | Source theme plus the typography helpers. Sets the theme selectors; no reset, no classless mappings. |
116
+ | `@codenhub/styles/tw/utilities` | Source theme and typography plus the layout and content helpers. Lists the package's class names so Tailwind always generates them. |
117
+ | `@codenhub/styles/tw/aesthetics` | All six aesthetics as source. `/tw/aesthetics/neobrutalism`, `/glass`, `/pixel`, `/chunky-tile`, `/cyber`, and `/sketch` publish one each. Plain CSS with no theme or reset side effects. |
118
+ | `@codenhub/styles/package.json` | The package manifest, as JSON. For tools that read the installed version or export map; it is not a stylesheet. |
119
+
120
+ Do not import two entrypoints that overlap, such as `@codenhub/styles` and `@codenhub/styles/components`, in one build unless duplicated CSS is acceptable. Pick the narrowest entrypoint that covers what a page needs.
121
+
122
+ ## Classless HTML
123
+
124
+ `@codenhub/styles/native` styles plain HTML elements without any classes, for content you cannot add classes to, such as Markdown output or a CMS body. It is the complete stylesheet plus these mappings:
125
+
126
+ | Element | Styled as |
127
+ | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
128
+ | `h1`, `h2`, `h3`, `h4`, `h5` and `h6` | `.text-title-lg`, `.text-title`, `.text-title-sm`, `.text-label-lg`, `.text-label` |
129
+ | `p`, `li` | `.text-body` |
130
+ | `table` | `.data-table` |
131
+ | `kbd`, `blockquote`, `q`, `code`, `pre` | `.kbd`, `.quote`, `.quote-inline`, `.code`, `.pre` |
132
+ | `hr` | `.divider` |
133
+ | `input` with no type, or type `text`, `number`, `email`, `password`, `url`, `tel`, `search`, `month`, `week`, `time`, `date`, `datetime-local` | `.ipt` |
134
+ | `textarea`, `select` | `.textarea`, `.select` |
135
+ | `input type="checkbox"`, `input type="radio"` | `.checkbox`, `.radio` |
136
+ | `button`, `input type="button"`, `type="submit"`, `type="reset"` | `.btn` |
65
137
 
66
138
  ```html
67
- <html>
68
- <body>
69
- <p class="dark:text-white">Follows the OS preference here</p>
70
- <div class="light">
71
- <p class="dark:text-white">Stays light -- this subtree forced it</p>
72
- </div>
73
- </body>
74
- </html>
139
+ <article>
140
+ <h2>Two-factor authentication</h2>
141
+ <p>Press <kbd>Ctrl</kbd> + <kbd>K</kbd> to open the command menu.</p>
142
+ <label for="code">Verification code</label>
143
+ <input id="code" type="text" inputmode="numeric" />
144
+ <label><input type="checkbox" /> Remember this device</label>
145
+ <button type="submit">Verify</button>
146
+ </article>
75
147
  ```
76
148
 
77
- An explicit selector at any depth wins over the system preference, in either direction, the same as the token theme it tracks.
78
-
79
- The one place it does not track the token theme: nesting an explicit selector inside the opposite one. `color-scheme` inherits, so a `.light` nested inside `.dark` themes its own tokens correctly regardless of depth -- the nearest declaration always wins. `dark:` matches by selector instead, and `.dark *` matches every descendant of a `.dark` element with no way to stop at a nearer `.light` in between, so a `dark:` utility inside that nested `.light` still fires even though the tokens around it are light. Apply one theme per subtree rather than nesting opposite ones if a page uses both tokens and `dark:` utilities together.
80
-
81
- ## Import paths
82
-
83
- Compiled entrypoints are ready-to-import CSS and require only tooling that can resolve package CSS imports. `/tw` entrypoints publish copied, uncompiled source from `dist/tw`; a Tailwind v4 build must still process their `@theme`, `@utility`, `@apply`, and related directives. Focused source component entrypoints include theme tokens so their classes can work independently.
84
-
85
- | Import path | Composition and effects |
86
- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
87
- | `@codenhub/styles` | Compiled complete surface: Tailwind base/theme output, tokens, typography, utilities, components, and reset. Applies global reset, root theme, and focus rules. |
88
- | `@codenhub/styles/theme` | Compiled Tailwind theme variables, Codenhub tokens, and the intent, presentation, elevation, and corner-pattern classes. Sets root theme properties and system/explicit theme selectors; no reset or component classes. |
89
- | `@codenhub/styles/palette` | Generated, self-contained `--palette-*` custom properties: every intent/presentation cell's fill, text, and edge color, plus the flat `border`/`surface`/`text` neutral tokens, pre-composed to a flat value. For a consumer that cannot take this package as a build-time dependency (an optional peer, for example) but wants to look consistent with it. Not a replacement for the components themselves when Tailwind is available -- see [Customizing → Generated palette](./usage/customizing.md#generated-palette). |
90
- | `@codenhub/styles/components` | Compiled theme tokens, typography utilities, and every component class. Each component carries its own reduced-motion rule and the `<dialog>` fix travels with `.card`; no reset, layout/content utilities, or native mappings. |
91
- | `@codenhub/styles/native` | Compiled complete surface plus classless mappings for headings, text, content elements, form controls, and buttons. Applies the reset and broad element selectors. |
92
- | `@codenhub/styles/aesthetics` | Compiled `.neobrutalism`, `.glass`, `.pixel`, `.chunky-tile`, `.cyber`, and `.sketch` classes, and each one's `-solo` class. Adds no tokens or components of its own; import in either order. |
93
- | `@codenhub/styles/aesthetics/*` | One compiled aesthetic and its solo class: `/neobrutalism`, `/glass`, `/pixel`, `/chunky-tile`, `/cyber`, or `/sketch`. Same rules and ordering as the combined file. |
94
- | `@codenhub/styles/tw` | Source equivalent of the complete stylesheet. Imports Tailwind itself, theme, typography, utilities, components, and reset; applies the same global rules. |
95
- | `@codenhub/styles/tw/theme` | Source theme, tokens, and presentation classes. Imports Tailwind's theme layer; emits root/system/explicit theme selectors and defines the package's custom `dark:` variant. |
96
- | `@codenhub/styles/tw/components` | Published Tailwind source for theme, typography, buttons, feedback, forms, loaders, surfaces, and tooltips, including static reduced-motion loader masks. No reset, layout/content utilities, or native mappings. |
97
- | `@codenhub/styles/tw/surface` | Source theme plus `.surface`, `.card`, and `.panel`. |
98
- | `@codenhub/styles/tw/button` | Published Tailwind source for theme and `.btn`. Pair it with `/tw/loader` for a loading state composed from `.loader`. |
99
- | `@codenhub/styles/tw/form` | Source theme plus field, public `text-control`, input, textarea, select, checkbox, radio, and switch utilities. |
100
- | `@codenhub/styles/tw/feedback` | Source theme plus alert, badge, skeleton, and progress utilities and their keyframes. |
101
- | `@codenhub/styles/tw/loader` | Published Tailwind source for activity indicators and loaders, including static reduced-motion masks. It has no theme or reset side effects and uses `currentColor`. |
102
- | `@codenhub/styles/tw/tooltip` | Source theme plus tooltip utilities. |
103
- | `@codenhub/styles/tw/reset` | Source theme, typography utilities, and global reset/accessibility rules. It changes root/body/elements and selection, motion, focus, scrollbar, and forced colors. |
104
- | `@codenhub/styles/tw/native` | Source complete surface plus reset and classless native-element mappings; broadest global effects. |
105
- | `@codenhub/styles/tw/typography` | Source theme plus typography utilities; sets theme selectors but no reset or classless mappings. |
106
- | `@codenhub/styles/tw/utilities` | Source theme and typography composition plus layout and content utilities; safelists the package utility names. |
107
- | `@codenhub/styles/tw/aesthetics` | Source aesthetics, combined. `/tw/aesthetics/neobrutalism`, `/glass`, `/pixel`, `/chunky-tile`, `/cyber`, and `/sketch` publish one apiece. Plain CSS with no theme or reset side effects. |
108
-
109
- Avoid importing overlapping entrypoints in the same build unless duplicate generated CSS is acceptable; pick the narrowest entrypoint that covers what a page needs.
149
+ What it does not do:
150
+
151
+ - **Some input types are left alone:** `file`, `range`, `color`, and `hidden` keep the browser's own look.
152
+ - **No switch.** A checkbox with `role="switch"` is still painted as a checkbox; the mapping does not read roles. A page that needs switches is better served by the class-based stylesheet.
153
+ - **Links keep the text around them.** A link inside a heading stays heading-sized; a link is never styled as a button.
154
+ - **`pre code` is not double-styled.** Code inside a `pre` drops its own background and padding.
155
+
156
+ The mappings are global: every matching element on the page is styled, including elements inside third-party widgets. They sit in the `base` [cascade layer](#cascade-layers), so any class beats them. Add an intent or presentation class to a mapped element, such as `<button class="destructive">`, and it applies as it would on `.btn`.
110
157
 
111
158
  ## Cascade layers
112
159
 
113
- Every entrypoint maps its CSS into Tailwind's four cascade layers (with documented unlayered exceptions), in Tailwind's order, and declares that order before using a layer, so the result does not depend on which file loads first:
160
+ Every entrypoint puts its CSS into Tailwind's four cascade layers and declares their order before using one, so the result does not depend on which file loads first:
114
161
 
115
- | Layer | Holds |
116
- | ------------ | ---------------------------------------------------------------------------------------------- |
117
- | `theme` | Tailwind's theme, the foundation tokens, the theme selectors, and `/palette`. |
118
- | `base` | The reset and the classless element styles. |
119
- | `components` | The intent, presentation, elevation, and aesthetic classes. |
120
- | `utilities` | Every component (`.btn`, `.card`, `.ipt`, ...), next to your own Tailwind utilities. |
121
- | _unlayered_ | The `forced-colors` and reduced-motion overrides, the `<dialog>` fix, and the `-solo` classes. |
162
+ | Layer | Holds |
163
+ | ------------ | --------------------------------------------------------------------------------------------------- |
164
+ | `theme` | Tailwind's theme, the foundation tokens, the theme selectors, and `/palette`. |
165
+ | `base` | The reset and the classless element styles. |
166
+ | `components` | The intent, presentation, elevation, and aesthetic classes. |
167
+ | `utilities` | Every component (`.btn`, `.card`, `.ipt`, and so on), next to your own Tailwind utilities. |
168
+ | _unlayered_ | The forced-colors and reduced-motion overrides, the closed-`<dialog>` fix, and the `-solo` classes. |
122
169
 
123
- What that means in practice:
170
+ What that means when you write your own CSS:
124
171
 
125
- - **Your utility or unlayered CSS beats an intent, presentation, elevation, or aesthetic class** on the same element for normal declarations. `[--ui-fill:50%]` on a `.solid` button, `font-serif` on a `.pixel` region, or `.my-card { --ui-radius: 0 }` in your own stylesheet all apply.
126
- - **A component and your utility share the `utilities` layer.** Which wins is decided by specificity and then source order, as between any two utilities. Your unlayered normal CSS always beats a component.
127
- - **State beats your intent.** An `aria-invalid` field stays destructive even with an intent utility on it.
128
- - **The `-solo` classes are unlayered on purpose**, so they beat a foreign component's own styles; tune them through their knobs rather than with utilities.
172
+ - **Your utility or unlayered CSS beats an intent, presentation, elevation, or aesthetic class** on the same element. `[--ui-fill:50%]` on a `.solid` button, `font-serif` on a `.pixel` region, or `.my-card { --ui-radius: 0 }` in your own stylesheet all apply.
173
+ - **A component and your utility share the `utilities` layer.** Specificity decides between them, then source order, as between any two utilities. Your unlayered CSS always beats a component.
174
+ - **State beats your intent.** A field with `aria-invalid="true"` stays destructive even with an intent utility on it.
175
+ - **The `-solo` classes are unlayered on purpose**, so they beat a third-party component's layered or zero-specificity styles. A more specific unlayered rule, or an equally specific one that loads later, still beats them; see [Solo classes](./usage/solo.md).
129
176
 
130
- ## Requirements
177
+ ## Next
131
178
 
132
- - Consumer tooling must resolve package CSS imports.
133
- - Every shipped stylesheet can be pasted into an HTML `<style>` element, for critical-CSS inlining or a server-rendered head: none contains the `</style` sequence that would end the element early.
134
- - Chrome 123, Safari 17.5, or Firefox 128 and newer. Color tokens are declared with `light-dark()` and selected by `color-scheme` (Firefox 120), `.input-group` propagates a nested control's invalid and disabled state with `:has()` (Firefox 121), and the elevation multiplier is registered non-inheriting with `@property` (Firefox 128; without it an elevation class would reach the unclassed elements inside it).
135
- - Tailwind CSS 4.3.2 or newer, below 5, is required only for `/tw` source entrypoints.
136
- - The package has no JavaScript runtime. Apps must provide semantic HTML, ARIA, keyboard behavior, focus management, validation, and announcements; see [Accessibility](./accessibility.md).
179
+ With the shell on the page, continue to [Building a screen](./concepts.md) to add a card, a form heading, and a Save button. If you use one of the frameworks above and have not wired it yet, do that first.