@deepgram/styles 0.2.11 → 0.2.13

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 (142) hide show
  1. package/README.md +285 -317
  2. package/design-system.yaml +3115 -3336
  3. package/dist/deepgram.css +1 -1
  4. package/dist/deepgram.expanded.css +741 -880
  5. package/dist/react/ActionGroup.d.ts +4 -0
  6. package/dist/react/ActionGroup.js +9 -0
  7. package/dist/react/Alert.d.ts +34 -0
  8. package/dist/react/Alert.js +71 -0
  9. package/dist/react/Btn.d.ts +11 -0
  10. package/dist/react/Btn.js +16 -0
  11. package/dist/react/Card.d.ts +26 -0
  12. package/dist/react/Card.js +51 -0
  13. package/dist/react/CardHeading.d.ts +4 -0
  14. package/dist/react/CardHeading.js +9 -0
  15. package/dist/react/CardHeadings.d.ts +7 -0
  16. package/dist/react/CardHeadings.js +16 -0
  17. package/dist/react/Checkbox.d.ts +4 -0
  18. package/dist/react/Checkbox.js +9 -0
  19. package/dist/react/CheckboxDescription.d.ts +4 -0
  20. package/dist/react/CheckboxDescription.js +9 -0
  21. package/dist/react/CheckboxGroup.d.ts +4 -0
  22. package/dist/react/CheckboxGroup.js +9 -0
  23. package/dist/react/CheckboxLabel.d.ts +4 -0
  24. package/dist/react/CheckboxLabel.js +9 -0
  25. package/dist/react/CodeBlock.d.ts +7 -0
  26. package/dist/react/CodeBlock.js +12 -0
  27. package/dist/react/Columns.d.ts +25 -0
  28. package/dist/react/Columns.js +44 -0
  29. package/dist/react/ConstrainWidth.d.ts +4 -0
  30. package/dist/react/ConstrainWidth.js +9 -0
  31. package/dist/react/DragDropZone.d.ts +17 -0
  32. package/dist/react/DragDropZone.js +38 -0
  33. package/dist/react/Footer.d.ts +10 -0
  34. package/dist/react/Footer.js +23 -0
  35. package/dist/react/FormError.d.ts +4 -0
  36. package/dist/react/FormError.js +9 -0
  37. package/dist/react/FormField.d.ts +4 -0
  38. package/dist/react/FormField.js +9 -0
  39. package/dist/react/FormHelper.d.ts +4 -0
  40. package/dist/react/FormHelper.js +9 -0
  41. package/dist/react/FormLabel.d.ts +4 -0
  42. package/dist/react/FormLabel.js +9 -0
  43. package/dist/react/GridMobileStack.d.ts +4 -0
  44. package/dist/react/GridMobileStack.js +9 -0
  45. package/dist/react/Hero.d.ts +25 -0
  46. package/dist/react/Hero.js +58 -0
  47. package/dist/react/Icon.d.ts +5 -0
  48. package/dist/react/Icon.js +10 -0
  49. package/dist/react/Input.d.ts +6 -0
  50. package/dist/react/Input.js +11 -0
  51. package/dist/react/ItemTitle.d.ts +4 -0
  52. package/dist/react/ItemTitle.js +9 -0
  53. package/dist/react/Newsletter.d.ts +8 -0
  54. package/dist/react/Newsletter.js +17 -0
  55. package/dist/react/Option.d.ts +4 -0
  56. package/dist/react/Option.js +9 -0
  57. package/dist/react/PageHeading.d.ts +10 -0
  58. package/dist/react/PageHeading.js +23 -0
  59. package/dist/react/PageHeadings.d.ts +13 -0
  60. package/dist/react/PageHeadings.js +30 -0
  61. package/dist/react/Prose.d.ts +6 -0
  62. package/dist/react/Prose.js +11 -0
  63. package/dist/react/Radio.d.ts +4 -0
  64. package/dist/react/Radio.js +9 -0
  65. package/dist/react/RadioDescription.d.ts +7 -0
  66. package/dist/react/RadioDescription.js +16 -0
  67. package/dist/react/RadioGroup.d.ts +4 -0
  68. package/dist/react/RadioGroup.js +9 -0
  69. package/dist/react/RadioLabel.d.ts +4 -0
  70. package/dist/react/RadioLabel.js +9 -0
  71. package/dist/react/Section.d.ts +9 -0
  72. package/dist/react/Section.js +14 -0
  73. package/dist/react/SectionHeading.d.ts +4 -0
  74. package/dist/react/SectionHeading.js +9 -0
  75. package/dist/react/Select.d.ts +4 -0
  76. package/dist/react/Select.js +9 -0
  77. package/dist/react/Spinner.d.ts +7 -0
  78. package/dist/react/Spinner.js +16 -0
  79. package/dist/react/Status.d.ts +12 -0
  80. package/dist/react/Status.js +17 -0
  81. package/dist/react/TextUtilities.d.ts +4 -0
  82. package/dist/react/TextUtilities.js +9 -0
  83. package/dist/react/Textarea.d.ts +4 -0
  84. package/dist/react/Textarea.js +9 -0
  85. package/dist/react/Toggle.d.ts +4 -0
  86. package/dist/react/Toggle.js +9 -0
  87. package/dist/react/ToggleGroup.d.ts +4 -0
  88. package/dist/react/ToggleGroup.js +9 -0
  89. package/dist/react/ToggleLabel.d.ts +4 -0
  90. package/dist/react/ToggleLabel.js +9 -0
  91. package/dist/react/index.d.ts +43 -0
  92. package/dist/react/index.js +43 -0
  93. package/dist/utils.d.ts +16 -0
  94. package/dist/utils.js +50 -0
  95. package/lib/deepgram.css +531 -486
  96. package/lib/tailwind-theme.css +0 -1
  97. package/package.json +17 -2
  98. package/src/react/ActionGroup.tsx +14 -0
  99. package/src/react/Alert.tsx +130 -0
  100. package/src/react/Btn.tsx +28 -0
  101. package/src/react/Card.tsx +93 -0
  102. package/src/react/CardHeading.tsx +14 -0
  103. package/src/react/CardHeadings.tsx +27 -0
  104. package/src/react/Checkbox.tsx +14 -0
  105. package/src/react/CheckboxDescription.tsx +14 -0
  106. package/src/react/CheckboxGroup.tsx +14 -0
  107. package/src/react/CheckboxLabel.tsx +14 -0
  108. package/src/react/CodeBlock.tsx +20 -0
  109. package/src/react/Columns.tsx +82 -0
  110. package/src/react/ConstrainWidth.tsx +14 -0
  111. package/src/react/DragDropZone.tsx +68 -0
  112. package/src/react/Footer.tsx +40 -0
  113. package/src/react/FormError.tsx +14 -0
  114. package/src/react/FormField.tsx +14 -0
  115. package/src/react/FormHelper.tsx +14 -0
  116. package/src/react/FormLabel.tsx +14 -0
  117. package/src/react/GridMobileStack.tsx +14 -0
  118. package/src/react/Hero.tsx +105 -0
  119. package/src/react/Icon.tsx +16 -0
  120. package/src/react/Input.tsx +18 -0
  121. package/src/react/ItemTitle.tsx +14 -0
  122. package/src/react/Newsletter.tsx +29 -0
  123. package/src/react/Option.tsx +14 -0
  124. package/src/react/PageHeading.tsx +40 -0
  125. package/src/react/PageHeadings.tsx +53 -0
  126. package/src/react/Prose.tsx +18 -0
  127. package/src/react/Radio.tsx +14 -0
  128. package/src/react/RadioDescription.tsx +27 -0
  129. package/src/react/RadioGroup.tsx +14 -0
  130. package/src/react/RadioLabel.tsx +14 -0
  131. package/src/react/Section.tsx +24 -0
  132. package/src/react/SectionHeading.tsx +14 -0
  133. package/src/react/Select.tsx +14 -0
  134. package/src/react/Spinner.tsx +27 -0
  135. package/src/react/Status.tsx +30 -0
  136. package/src/react/TextUtilities.tsx +14 -0
  137. package/src/react/Textarea.tsx +14 -0
  138. package/src/react/Toggle.tsx +14 -0
  139. package/src/react/ToggleGroup.tsx +14 -0
  140. package/src/react/ToggleLabel.tsx +14 -0
  141. package/src/react/index.ts +43 -0
  142. package/src/utils.ts +60 -0
package/README.md CHANGED
@@ -2,315 +2,382 @@
2
2
 
3
3
  A comprehensive, YAML-driven design system and CSS component library for building consistent Deepgram applications. Built on Tailwind CSS v4 with automatic light/dark mode, BEM methodology, and zero-config theming.
4
4
 
5
- ## Features
6
-
7
- ### Automatic Light/Dark Mode
8
-
9
- Every color token uses the CSS `light-dark()` function, giving you automatic theme support with zero configuration:
10
-
11
- - **System-aware**: Follows the user's OS light/dark preference out of the box
12
- - **Overridable**: Force a specific mode with a single line of CSS (`color-scheme: dark`)
13
- - **No JS required**: Pure CSS implementation — no class toggling, no build-time config
14
- - **WCAG-compliant**: Light mode brand colors are tuned for AA contrast ratios on white
15
-
16
- ### YAML-Driven Design Tokens
17
-
18
- All tokens, components, and examples are defined in a single `design-system.yaml` source of truth:
19
-
20
- - **Colors**: Brand, background, border, text, status, and gradient tokens — each with dark and light values
21
- - **Typography**: Font families, sizes, and weights with Tailwind integration
22
- - **Spacing**: Consistent spacing scale in `rem` units
23
- - **Border radius**: Rounded corner presets
24
- - **Shadows**: Elevation levels from subtle to prominent
25
- - **Logos**: 12 SVG logo variants (adaptive, light, dark) across wordmark, lettermark, square, and circle types
26
-
27
- ### CSS Architecture
28
-
29
- - **Tailwind CSS v4**: CSS-first configuration with `@theme` custom properties
30
- - **BEM naming**: `.dg-{block}`, `.dg-{block}__{element}`, `.dg-{block}--{modifier}`
31
- - **Custom utilities**: `dg-gradient-border`, `dg-glow-cyan-green`, `dg-bg-reset`, `dg-shadow-subtle`
32
- - **Responsive**: Mobile-first breakpoints with progressive enhancement
33
- - **Adaptive contrast tokens**: `dg-solid` / `dg-on-solid` for elements that invert between modes
34
-
35
- ### Customizable Brand Colors
36
-
37
- Two CSS variables control the entire brand palette — gradient borders, glow effects, buttons, links, and highlights all derive from them automatically:
38
-
39
- ```css
40
- :root {
41
- --dg-primary: #ff6b35; /* Your primary brand color */
42
- --dg-secondary: #4ecdc4; /* Your secondary brand color */
43
- }
44
- ```
45
-
46
- ### Logo Assets
47
-
48
- 12 production-ready SVG logos included as package exports:
49
-
50
- | Type | Adaptive | Light | Dark |
51
- |------|----------|-------|------|
52
- | Wordmark | `@deepgram/styles/logo/wordmark` | `@deepgram/styles/logo/wordmark-light` | `@deepgram/styles/logo/wordmark-dark` |
53
- | Lettermark | `@deepgram/styles/logo/lettermark` | `@deepgram/styles/logo/lettermark-light` | `@deepgram/styles/logo/lettermark-dark` |
54
- | Square | `@deepgram/styles/logo/lettermark-square` | `@deepgram/styles/logo/lettermark-square-light` | `@deepgram/styles/logo/lettermark-square-dark` |
55
- | Circle | `@deepgram/styles/logo/lettermark-circle` | `@deepgram/styles/logo/lettermark-circle-light` | `@deepgram/styles/logo/lettermark-circle-dark` |
56
-
57
- Adaptive variants use embedded CSS `@media (prefers-color-scheme)` to switch automatically.
58
-
59
- ---
60
-
61
5
  ## Quick Start
62
6
 
63
- You'll need two things: the Deepgram Styles package and [Font Awesome](https://fontawesome.com/search?o=r&m=free) for icons. Choose between CDN (fastest setup) or npm (production-ready).
7
+ ### CDN
64
8
 
65
- ### Option 1: CDN
66
-
67
- Add these lines to your HTML `<head>`:
9
+ Add to your HTML `<head>`:
68
10
 
69
11
  ```html
70
12
  <!-- Deepgram Styles -->
71
13
  <link rel="stylesheet" href="https://unpkg.com/@deepgram/styles/dist/deepgram.css">
72
14
 
73
15
  <!-- Font Awesome for icons -->
74
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer">
16
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
17
+ integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="
18
+ crossorigin="anonymous" referrerpolicy="no-referrer">
75
19
  ```
76
20
 
77
- Or use jsDelivr for Deepgram Styles:
21
+ jsDelivr alternative:
78
22
 
79
23
  ```html
80
24
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@deepgram/styles/dist/deepgram.css">
81
25
  ```
82
26
 
83
- ### Option 2: NPM (Production)
84
-
85
- Install both packages:
27
+ ### npm
86
28
 
87
29
  ```bash
88
30
  npm install @deepgram/styles @fortawesome/fontawesome-free
89
31
  ```
90
32
 
91
- Then import in your JavaScript/TypeScript entry file:
33
+ Import in your JS/TS entry file:
92
34
 
93
35
  ```javascript
94
36
  import '@deepgram/styles';
95
37
  import '@fortawesome/fontawesome-free/css/all.min.css';
96
38
  ```
97
39
 
98
- That's it. Light/dark mode works automatically based on the user's OS preference.
99
-
100
- ## Usage
40
+ ### Verify it works
101
41
 
102
- Browse the [Component Showcase](https://design.dx.deepgram.com), copy the markup, and use it in your project:
103
-
104
- ```html
105
- <button class="dg-btn dg-btn--primary">Get Started</button>
106
- ```
107
-
108
- Components use [Font Awesome](https://fontawesome.com/search?o=r&m=free) icons:
42
+ Paste this into your page you should see a styled green button:
109
43
 
110
44
  ```html
111
45
  <button class="dg-btn dg-btn--primary">
112
- <i class="fas fa-play"></i>
113
- Start Recording
46
+ <i class="fas fa-check"></i>
47
+ It works!
114
48
  </button>
115
49
  ```
116
50
 
117
- ### Pre-built CSS
51
+ ---
118
52
 
119
- The default import provides a minified, production-ready stylesheet:
53
+ ## Using the Stylesheet
120
54
 
121
- ```javascript
122
- import "@deepgram/styles";
55
+ ### BEM Naming
56
+
57
+ All classes use the `dg-` prefix with BEM methodology:
58
+
59
+ | Pattern | Purpose | Example |
60
+ |---------|---------|---------|
61
+ | `.dg-{name}` | Block (root component) | `.dg-btn`, `.dg-card` |
62
+ | `.dg-{name}__{element}` | Element (child part) | `.dg-card__header`, `.dg-card__body` |
63
+ | `.dg-{name}--{modifier}` | Modifier (variant) | `.dg-btn--primary`, `.dg-card--compact` |
64
+
65
+ ### Light/Dark Mode
66
+
67
+ The stylesheet uses CSS `light-dark()` for all color tokens — theme switching is automatic:
68
+
69
+ - **Automatic**: Follows OS preference out of the box (`color-scheme: light dark` on `:root`)
70
+ - **No JS required**: Pure CSS implementation — no class toggling
71
+
72
+ Force a mode:
73
+
74
+ ```css
75
+ :root { color-scheme: dark; } /* Always dark */
76
+ :root { color-scheme: light; } /* Always light */
123
77
  ```
124
78
 
125
- Or link directly in HTML:
79
+ Or via JavaScript:
126
80
 
127
- ```html
128
- <link rel="stylesheet" href="node_modules/@deepgram/styles/dist/deepgram.css" />
81
+ ```javascript
82
+ document.documentElement.style.colorScheme = 'dark'; // Force dark
83
+ document.documentElement.style.colorScheme = 'light'; // Force light
84
+ document.documentElement.style.removeProperty('color-scheme'); // System
129
85
  ```
130
86
 
131
- ### Expanded CSS (Non-minified)
87
+ ### Theme Utilities
132
88
 
133
- For development or easier debugging:
89
+ For apps with a theme toggle and localStorage persistence:
134
90
 
135
91
  ```javascript
136
- import "@deepgram/styles/expanded";
92
+ import { setLight, setDark, setSystem, getTheme, restoreTheme, onThemeChange } from '@deepgram/styles/utils';
93
+
94
+ setLight(); // Force light (persists to localStorage)
95
+ setDark(); // Force dark
96
+ setSystem(); // Follow OS preference
97
+
98
+ const theme = getTheme(); // 'light' | 'dark' | 'system'
99
+
100
+ restoreTheme(); // Call in <head> to prevent flash of wrong theme
101
+
102
+ const unsubscribe = onThemeChange((theme) => {
103
+ console.log('Theme changed to:', theme);
104
+ });
137
105
  ```
138
106
 
139
- ### Using with Tailwind CSS v4
107
+ ### Brand Customization
140
108
 
141
- If you're using Tailwind CSS v4 in your project, import the Deepgram theme CSS in your main stylesheet:
109
+ Two CSS variables control the entire brand palette — gradients, glows, buttons, and links all derive from them:
142
110
 
143
111
  ```css
144
- /* Import Deepgram theme (includes @import "tailwindcss") */
145
- @import "@deepgram/styles/theme";
112
+ :root {
113
+ --dg-primary: #ff6b35; /* Your primary color */
114
+ --dg-secondary: #4ecdc4; /* Your secondary color */
115
+ }
146
116
  ```
147
117
 
148
- This provides all Deepgram design tokens (`--color-dg-*`, `--font-dg-*`, `--spacing-dg-*`, etc.), base styles, and custom utilities via Tailwind v4's CSS-first configuration.
118
+ In light mode, brand colors automatically switch to WCAG-compliant darker variants. You can scope to a section:
119
+
120
+ ```css
121
+ .partner-section {
122
+ --dg-primary: #a855f7;
123
+ --dg-secondary: #ec4899;
124
+ }
125
+ ```
149
126
 
150
- ### Importing Source Files
127
+ ### Base Font Size
151
128
 
152
- To customize and build the styles yourself:
129
+ Everything uses `rem` units. Change the base and everything scales:
153
130
 
154
131
  ```css
155
- @import "@deepgram/styles/source";
132
+ :root {
133
+ --dg-base-font-size: 18px;
134
+ }
156
135
  ```
157
136
 
158
- ### Design System YAML
137
+ ### Tailwind CSS v4 Integration
159
138
 
160
- Access the raw design tokens programmatically:
139
+ If your project uses Tailwind v4, import the theme for all design tokens as Tailwind utilities:
161
140
 
162
- ```javascript
163
- import tokens from "@deepgram/styles/design-system";
141
+ ```css
142
+ @import "@deepgram/styles/theme";
164
143
  ```
165
144
 
145
+ This provides `--color-dg-*`, `--font-dg-*`, `--spacing-dg-*` tokens, base styles, custom utilities, and includes `@import "tailwindcss"`.
146
+
166
147
  ---
167
148
 
168
- ## Configuration
149
+ ## React Components
169
150
 
170
- ### Light/Dark Mode
151
+ Typed React wrappers with boolean variant props, ref forwarding, and className merging.
171
152
 
172
- The stylesheet sets `color-scheme: light dark` on `:root`, so it follows the OS preference automatically. To force a specific mode:
153
+ ### Setup
173
154
 
174
- ```css
175
- /* Force dark mode */
176
- :root { color-scheme: dark; }
155
+ ```bash
156
+ npm install @deepgram/styles react @fortawesome/fontawesome-free
157
+ ```
158
+
159
+ ```tsx
160
+ // Entry point — import CSS once
161
+ import '@deepgram/styles';
162
+ import '@fortawesome/fontawesome-free/css/all.min.css';
177
163
 
178
- /* Force light mode */
179
- :root { color-scheme: light; }
164
+ // Any component file
165
+ import { Btn, Card, CardHeader, CardBody, Prose } from '@deepgram/styles/react';
180
166
  ```
181
167
 
182
- Or toggle via JavaScript:
168
+ ### API
183
169
 
184
- ```javascript
185
- // Follow system preference (default)
186
- document.documentElement.style.removeProperty('color-scheme');
170
+ - **Boolean variant props**: `<Btn primary>` renders `.dg-btn.dg-btn--primary`
171
+ - **className merging**: Pass `className` to add your own classes
172
+ - **Ref forwarding**: All components use `forwardRef`
173
+ - **Native props**: All extra props spread onto the underlying HTML element
187
174
 
188
- // Force dark
189
- document.documentElement.style.colorScheme = 'dark';
175
+ ```tsx
176
+ // HTML
177
+ <button class="dg-btn dg-btn--primary dg-btn--sm">Save</button>
190
178
 
191
- // Force light
192
- document.documentElement.style.colorScheme = 'light';
193
- ```
179
+ // React
180
+ <Btn primary sm>Save</Btn>
194
181
 
195
- ### Base Font Size
182
+ // With extras
183
+ <Btn primary sm className="my-class" onClick={handleSave} disabled={loading}>
184
+ Save
185
+ </Btn>
186
+ ```
196
187
 
197
- The entire design system uses `rem` units that scale relative to the root font size:
188
+ ### Component Reference
189
+
190
+ | Component | CSS Class | Variant Props |
191
+ |-----------|-----------|---------------|
192
+ | `Btn` | `.dg-btn` | `primary`, `secondary`, `ghost`, `dangerGhost`, `iconOnly`, `sm`, `collapse` |
193
+ | `Card` | `.dg-card` | `structured`, `compact`, `spacious`, `bordered` |
194
+ | `CardImage` | `.dg-card__image` | Use `className="dg-card__image--medium"` etc. |
195
+ | `CardHeader` | `.dg-card__header` | — |
196
+ | `CardBody` | `.dg-card__body` | — |
197
+ | `CardFooter` | `.dg-card__footer` | — |
198
+ | `Section` | `.dg-section` | `compact`, `spacious`, `bordered`, `elevated`, `fieldset` |
199
+ | `SectionHeading` | `.dg-section-heading` | — |
200
+ | `PageHeading` | `.dg-page-heading` | — |
201
+ | `Input` | `.dg-input` | `inline` |
202
+ | `Textarea` | `.dg-textarea` | — |
203
+ | `Checkbox` | `.dg-checkbox` | — |
204
+ | `Select` | `.dg-select` | — |
205
+ | `Radio` | `.dg-radio` | — |
206
+ | `Toggle` | `.dg-toggle` | — |
207
+ | `FormField` | `.dg-form-field` | `error`, `success` |
208
+ | `FormLabel` | `.dg-form-label` | — |
209
+ | `FormHelper` | `.dg-form-helper` | — |
210
+ | `Alert` | `.dg-alert` | `info`, `success`, `warning`, `danger` |
211
+ | `Status` | `.dg-status` | `info`, `success`, `warning`, `error`, `primary`, `secondary` |
212
+ | `Spinner` | `.dg-spinner` | — |
213
+ | `Prose` | `.dg-prose` | `large`, `small`, `block` |
214
+ | `Hero` | `.dg-hero` | — |
215
+ | `CodeBlock` | `.dg-code-block` | `compact`, `tall`, `noScroll` — add [`prismjs`](https://www.npmjs.com/package/prismjs) for syntax highlighting |
216
+ | `Footer` | `.dg-footer` | — |
217
+ | `Newsletter` | `.dg-newsletter-container` | — |
218
+ | `ActionGroup` | `.dg-action-group` | — |
219
+ | `ConstrainWidth` | `.dg-constrain-width` | — |
220
+ | `GridMobileStack` | `.dg-grid-mobile-stack` | — |
221
+
222
+ Sub-components for `Card`, `Hero`, `Alert`, `DragDropZone`, `Columns`, `Footer`, and `Newsletter` are also exported — see [full exports](./src/react/index.ts).
223
+
224
+ ### CodeBlock with Syntax Highlighting
225
+
226
+ The `CodeBlock` component provides container styling. For syntax highlighting, add `prismjs`:
198
227
 
199
- ```css
200
- :root {
201
- --dg-base-font-size: 18px; /* Scale everything up */
202
- }
228
+ ```bash
229
+ npm install prismjs
230
+ ```
203
231
 
204
- @media (max-width: 768px) {
205
- :root {
206
- --dg-base-font-size: 14px; /* Smaller on mobile */
207
- }
232
+ ```tsx
233
+ import { CodeBlock } from '@deepgram/styles/react';
234
+ import Prism from 'prismjs';
235
+ import 'prismjs/components/prism-javascript';
236
+ import 'prismjs/themes/prism-tomorrow.css';
237
+ import { useEffect } from 'react';
238
+
239
+ function CodeExample({ code, language }: { code: string; language: string }) {
240
+ useEffect(() => { Prism.highlightAll(); }, [code]);
241
+
242
+ return (
243
+ <CodeBlock>
244
+ <pre><code className={`language-${language}`}>{code}</code></pre>
245
+ </CodeBlock>
246
+ );
208
247
  }
209
248
  ```
210
249
 
211
- ### Brand Colors
250
+ `prismjs` is optional — you can use any highlighting library (Shiki, Highlight.js, etc.).
212
251
 
213
- Two variables control the entire brand palette:
252
+ ### Theme Toggle in React
214
253
 
215
- ```css
216
- :root {
217
- --dg-primary: #13ef95; /* Deepgram green */
218
- --dg-secondary: #149afb; /* Deepgram blue */
254
+ ```tsx
255
+ import { Btn, ActionGroup } from '@deepgram/styles/react';
256
+ import { setLight, setDark, setSystem, getTheme, onThemeChange } from '@deepgram/styles/utils';
257
+ import { useState, useEffect } from 'react';
258
+
259
+ function ThemeToggle() {
260
+ const [theme, setTheme] = useState(getTheme());
261
+ useEffect(() => onThemeChange(setTheme), []);
262
+
263
+ return (
264
+ <ActionGroup>
265
+ <Btn primary={theme === 'light'} ghost={theme !== 'light'} sm onClick={setLight}>Light</Btn>
266
+ <Btn primary={theme === 'dark'} ghost={theme !== 'dark'} sm onClick={setDark}>Dark</Btn>
267
+ <Btn primary={theme === 'system'} ghost={theme !== 'system'} sm onClick={setSystem}>System</Btn>
268
+ </ActionGroup>
269
+ );
219
270
  }
220
271
  ```
221
272
 
222
- In light mode, brand colors automatically switch to WCAG-compliant darker variants (`#047857` and `#0369a1` by default). Gradient borders, glow effects, buttons, links, and highlights all derive from these two variables.
273
+ ---
223
274
 
224
- ```css
225
- /* Theme variations */
226
- .theme-purple {
227
- --dg-primary: #a855f7;
228
- --dg-secondary: #ec4899;
229
- }
275
+ ## Web Components (Experimental)
230
276
 
231
- .theme-ocean {
232
- --dg-primary: #16a085;
233
- --dg-secondary: #3498db;
234
- }
277
+ Auto-generated custom elements with Shadow DOM, built from the same YAML source.
278
+
279
+ ```html
280
+ <script type="module">
281
+ import '@deepgram/styles/dist/components/web-components/btn.js';
282
+ </script>
283
+
284
+ <dg-btn primary>Get Started</dg-btn>
235
285
  ```
236
286
 
237
- ---
287
+ - Tag names match YAML keys with `dg-` prefix: `btn` → `<dg-btn>`
288
+ - Variants become boolean attributes: `<dg-btn primary sm>`
289
+ - Content projected via `<slot>` elements
238
290
 
239
- ## Color Tokens
291
+ > **Note**: Web Components are currently experimental. For production, use CSS classes or React components.
240
292
 
241
- All color tokens are available as CSS custom properties and Tailwind utilities:
293
+ ---
242
294
 
243
- ### Background Colors
295
+ ## Package Exports
244
296
 
245
- | Token | Variable | Dark | Light |
246
- |-------|----------|------|-------|
247
- | `dg-almost-black` | `--color-dg-almost-black` | `#050506` | `#f8f9fa` |
248
- | `dg-background` | `--color-dg-background` | `#0b0b0c` | `#ffffff` |
249
- | `dg-charcoal` | `--color-dg-charcoal` | `#1a1a1f` | `#f3f4f6` |
250
- | `dg-solid` | `--color-dg-solid` | `#ffffff` | `#000000` |
297
+ | Import | Description |
298
+ |--------|-------------|
299
+ | `@deepgram/styles` | Minified production CSS (default) |
300
+ | `@deepgram/styles/expanded` | Non-minified CSS for debugging |
301
+ | `@deepgram/styles/theme` | Tailwind v4 theme CSS with all tokens |
302
+ | `@deepgram/styles/source` | Source CSS with `@apply` directives |
303
+ | `@deepgram/styles/react` | Typed React components |
304
+ | `@deepgram/styles/utils` | Theme utility functions |
305
+ | `@deepgram/styles/design-system` | Raw YAML design tokens |
306
+ | `@deepgram/styles/logo/*` | 12 SVG logo variants |
251
307
 
252
- ### Border Colors
308
+ ---
253
309
 
254
- | Token | Variable | Dark | Light |
255
- |-------|----------|------|-------|
256
- | `dg-border` | `--color-dg-border` | `#2c2c33` | `#d1d5db` |
257
- | `dg-pebble` | `--color-dg-pebble` | `#4e4e52` | `#9ca3af` |
258
- | `dg-slate` | `--color-dg-slate` | `#949498` | `#6b7280` |
310
+ ## Design Tokens
311
+
312
+ All tokens are CSS custom properties and Tailwind utilities (`bg-dg-*`, `text-dg-*`, `border-dg-*`, etc.).
259
313
 
260
- ### Text Colors
314
+ ### Colors
261
315
 
262
316
  | Token | Variable | Dark | Light |
263
317
  |-------|----------|------|-------|
318
+ | `dg-primary` | `--dg-primary` | `#13ef95` | `#047857` |
319
+ | `dg-secondary` | `--dg-secondary` | `#149afb` | `#0369a1` |
320
+ | `dg-background` | `--color-dg-background` | `#0b0b0c` | `#ffffff` |
321
+ | `dg-almost-black` | `--color-dg-almost-black` | `#050506` | `#f8f9fa` |
322
+ | `dg-charcoal` | `--color-dg-charcoal` | `#1a1a1f` | `#f3f4f6` |
323
+ | `dg-solid` | `--color-dg-solid` | `#ffffff` | `#000000` |
264
324
  | `dg-text` | `--color-dg-text` | `#fbfbff` | `#111827` |
265
325
  | `dg-fog` | `--color-dg-fog` | `#edede2` | `#1f2937` |
266
326
  | `dg-platinum` | `--color-dg-platinum` | `#e1e1e5` | `#374151` |
267
327
  | `dg-muted` | `--color-dg-muted` | `#949498` | `#6b7280` |
268
328
  | `dg-on-solid` | `--color-dg-on-solid` | `#000000` | `#ffffff` |
269
-
270
- ### Status Colors
271
-
272
- | Token | Variable | Dark | Light |
273
- |-------|----------|------|-------|
329
+ | `dg-border` | `--color-dg-border` | `#2c2c33` | `#d1d5db` |
330
+ | `dg-pebble` | `--color-dg-pebble` | `#4e4e52` | `#9ca3af` |
331
+ | `dg-slate` | `--color-dg-slate` | `#949498` | `#6b7280` |
274
332
  | `dg-success` | `--color-dg-success` | `#12b76a` | `#15803d` |
275
333
  | `dg-warning` | `--color-dg-warning` | `#fec84b` | `#a16207` |
276
334
  | `dg-danger` | `--color-dg-danger` | `#f04438` | `#b91c1c` |
277
335
 
278
- ### Brand Colors
336
+ ### Spacing
279
337
 
280
- | Token | Variable | Dark | Light |
281
- |-------|----------|------|-------|
282
- | `dg-primary` | `--dg-primary` | `#13ef95` | `#047857` |
283
- | `dg-secondary` | `--dg-secondary` | `#149afb` | `#0369a1` |
338
+ | Token | Value | CSS Variable | Tailwind |
339
+ |-------|-------|-------------|----------|
340
+ | `xs` | `0.25rem` | `--spacing-dg-xs` | `p-dg-xs`, `m-dg-xs`, `gap-dg-xs` |
341
+ | `sm` | `0.5rem` | `--spacing-dg-sm` | `p-dg-sm`, `m-dg-sm`, `gap-dg-sm` |
342
+ | `md` | `1rem` | `--spacing-dg-md` | `p-dg-md`, `m-dg-md`, `gap-dg-md` |
343
+ | `lg` | `1.5rem` | `--spacing-dg-lg` | `p-dg-lg`, `m-dg-lg`, `gap-dg-lg` |
344
+ | `xl` | `2rem` | `--spacing-dg-xl` | `p-dg-xl`, `m-dg-xl`, `gap-dg-xl` |
345
+ | `2xl` | `3rem` | `--spacing-dg-2xl` | `p-dg-2xl`, `m-dg-2xl`, `gap-dg-2xl` |
346
+
347
+ ### Border Radius
284
348
 
285
- All tokens work with standard Tailwind utility prefixes: `bg-dg-*`, `text-dg-*`, `border-dg-*`, `ring-dg-*`, etc.
349
+ | Token | Value | CSS Variable | Tailwind |
350
+ |-------|-------|-------------|----------|
351
+ | `sm` | `0.25rem` | `--radius-dg-sm` | `rounded-dg-sm` |
352
+ | `md` | `0.5rem` | `--radius-dg-md` | `rounded-dg-md` |
353
+ | `lg` | `0.75rem` | `--radius-dg-lg` | `rounded-dg-lg` |
354
+ | `xl` | `1rem` | `--radius-dg-xl` | `rounded-dg-xl` |
355
+
356
+ ### Shadows
357
+
358
+ | Token | CSS Variable | Tailwind |
359
+ |-------|-------------|----------|
360
+ | `sm` | `--shadow-dg-sm` | `shadow-dg-sm` |
361
+ | `md` | `--shadow-dg-md` | `shadow-dg-md` |
362
+ | `lg` | `--shadow-dg-lg` | `shadow-dg-lg` |
286
363
 
287
364
  ---
288
365
 
289
366
  ## Components
290
367
 
291
- All components use BEM naming with the `dg-` prefix.
368
+ All components use BEM naming with the `dg-` prefix. Browse the [Component Showcase](https://design.dx.deepgram.com) for live examples.
292
369
 
293
370
  ### Buttons
294
371
 
295
372
  ```html
296
- <button class="dg-btn dg-btn--primary">Primary Action</button>
373
+ <button class="dg-btn dg-btn--primary">Primary</button>
297
374
  <button class="dg-btn dg-btn--secondary">Secondary</button>
298
375
  <button class="dg-btn dg-btn--ghost">Ghost</button>
299
- <button class="dg-btn dg-btn--danger-ghost">Delete</button>
376
+ <button class="dg-btn dg-btn--danger-ghost">Danger</button>
300
377
  <button class="dg-btn dg-btn--icon-only"><i class="fas fa-play"></i></button>
378
+ <button class="dg-btn dg-btn--primary dg-btn--sm">Small</button>
301
379
  ```
302
380
 
303
- | Class | Description |
304
- |-------|-------------|
305
- | `.dg-btn` | Base button with flexbox centering, font styles, and disabled states |
306
- | `.dg-btn--primary` | Gradient border with brand colors and glow effect |
307
- | `.dg-btn--secondary` | Solid contrasting fill (white on dark, black on light) |
308
- | `.dg-btn--ghost` | Transparent with border, text adapts to theme |
309
- | `.dg-btn--danger-ghost` | Transparent with danger-colored border |
310
- | `.dg-btn--icon-only` | Square button for icons |
311
- | `.dg-btn--sm` | Small variant (2.25rem height) |
312
- | `.dg-btn--collapse` | Full-width on mobile, inline on desktop |
313
-
314
381
  ### Cards
315
382
 
316
383
  ```html
@@ -324,74 +391,32 @@ All components use BEM naming with the `dg-` prefix.
324
391
  <div class="dg-card__body">
325
392
  <p class="dg-prose">Card content.</p>
326
393
  </div>
327
- <div class="dg-card__footer">
394
+ <div class="dg-card__footer dg-card__footer--bordered">
328
395
  <button class="dg-btn dg-btn--primary">Action</button>
329
396
  </div>
330
397
  </div>
331
398
  ```
332
399
 
333
- | Class | Description |
334
- |-------|-------------|
335
- | `.dg-card` | Base card with border, background, and padding |
336
- | `.dg-card--compact` | Reduced padding |
337
- | `.dg-card--spacious` | Increased padding |
338
- | `.dg-card--bordered` | Enhanced border |
339
- | `.dg-card--structured` | Optimized for image/header/body/footer layout |
340
- | `.dg-card__image` | Image container with `--small`, `--medium`, `--large`, `--aspect-4-3` sizes |
341
- | `.dg-card__icon` | Icon container with `--left`, `--center`, `--right` alignment |
342
- | `.dg-card__header` | Header section |
343
- | `.dg-card__body` | Body content section |
344
- | `.dg-card__footer` | Footer actions section with optional `--bordered` |
400
+ ### Forms
401
+
402
+ ```html
403
+ <div class="dg-form-field">
404
+ <label class="dg-form-label">Email</label>
405
+ <input type="email" class="dg-input" placeholder="you@example.com" />
406
+ <p class="dg-form-helper">We'll never share your email.</p>
407
+ </div>
408
+ ```
345
409
 
346
410
  ### Layout
347
411
 
348
412
  | Class | Description |
349
413
  |-------|-------------|
350
- | `.dg-section` | Content section with margin and padding |
351
- | `.dg-section--compact` | Reduced spacing |
352
- | `.dg-section--spacious` | Increased spacing |
353
- | `.dg-section--bordered` | Border and background |
354
- | `.dg-section--elevated` | Shadow elevation |
355
- | `.dg-section--fieldset` | Fieldset-style with legend |
414
+ | `.dg-section` | Content section (`--compact`, `--spacious`, `--bordered`, `--elevated`, `--fieldset`) |
356
415
  | `.dg-constrain-width` | Max-width container (60rem) |
357
416
  | `.dg-center-h` | Center content horizontally |
358
417
  | `.dg-grid-mobile-stack` | Responsive grid, stacks on mobile |
359
418
  | `.dg-action-group` | Button group container |
360
419
 
361
- ### Multi-Column Layout
362
-
363
- ```html
364
- <div class="dg-layout-three-column">
365
- <header class="dg-layout-three-column__header">...</header>
366
- <div class="dg-layout-three-column__main">
367
- <div class="dg-layout-three-column__left-main-wrapper">
368
- <div class="dg-layout-three-column__sidebar-left">...</div>
369
- <div class="dg-layout-three-column__content">...</div>
370
- </div>
371
- <div class="dg-layout-three-column__sidebar-right">...</div>
372
- </div>
373
- </div>
374
- ```
375
-
376
- ### Hero Section
377
-
378
- ```html
379
- <section class="dg-hero">
380
- <div class="dg-hero__content">
381
- <a href="#" class="dg-hero__announcement">
382
- <span class="dg-hero__announcement-text">New feature announcement</span>
383
- <span class="dg-hero__announcement-cta">Learn More</span>
384
- </a>
385
- <h1 class="dg-hero-title">Your Hero Title</h1>
386
- <p class="dg-hero__body">Your hero description text.</p>
387
- <div class="dg-hero__actions">
388
- <button class="dg-btn dg-btn--primary">Get Started</button>
389
- <button class="dg-btn dg-btn--ghost">Learn More</button>
390
- </div>
391
- </div>
392
- </section>
393
- ```
394
-
395
420
  ### Typography
396
421
 
397
422
  | Class | Description |
@@ -400,111 +425,54 @@ All components use BEM naming with the `dg-` prefix.
400
425
  | `.dg-section-heading` | Section heading |
401
426
  | `.dg-card-heading` | Card heading |
402
427
  | `.dg-item-title` | Item title |
403
- | `.dg-prose` | Body text (max-width 65ch) |
404
- | `.dg-prose--large` | Larger prose |
405
- | `.dg-prose--small` | Smaller prose |
406
- | `.dg-prose--block` | Full-width prose (no max-width) |
428
+ | `.dg-prose` | Body text (`--large`, `--small`, `--block`) |
407
429
  | `.dg-text-tagline` | Centered tagline |
408
430
  | `.dg-text-subtitle` | Subtitle text |
409
- | `.dg-text-heading` | Standard heading |
410
- | `.dg-text-legal` | Fine print |
411
-
412
- ### Forms
413
-
414
- ```html
415
- <div class="dg-form-field">
416
- <label class="dg-form-label">Email</label>
417
- <input type="email" class="dg-input" placeholder="you@example.com" />
418
- <p class="dg-form-helper">We'll never share your email.</p>
419
- </div>
420
- ```
421
-
422
- | Class | Description |
423
- |-------|-------------|
424
- | `.dg-input` | Text input with focus/disabled states |
425
- | `.dg-input--inline` | Inline input (min-width 12.5rem) |
426
- | `.dg-textarea` | Multi-line text input |
427
- | `.dg-checkbox` | Custom styled checkbox with animation |
428
- | `.dg-checkbox-label` | Checkbox label wrapper |
429
- | `.dg-checkbox-description` | Checkbox with description |
430
- | `.dg-form-field` | Field container (label + input + helper) |
431
- | `.dg-form-field--error` | Error validation state |
432
- | `.dg-form-field--success` | Success validation state |
433
- | `.dg-form-label` | Form label |
434
- | `.dg-form-helper` | Helper/validation text |
435
- | `.dg-drag-drop-zone` | File upload drag-and-drop area |
436
431
 
437
432
  ### Feedback
438
433
 
439
434
  | Class | Description |
440
435
  |-------|-------------|
441
- | `.dg-alert` | Alert container with `--info`, `--success`, `--warning`, `--error` variants |
442
- | `.dg-status` | Status badge with `--info`, `--success`, `--warning`, `--error`, `--primary`, `--secondary` |
443
- | `.dg-spinner` | Loading spinner animation |
436
+ | `.dg-alert` | Alert (`--info`, `--success`, `--warning`, `--error`) |
437
+ | `.dg-status` | Status badge (`--info`, `--success`, `--warning`, `--error`, `--primary`, `--secondary`) |
438
+ | `.dg-spinner` | Loading spinner |
444
439
  | `.dg-modal-overlay` | Modal backdrop |
445
- | `.dg-modal-content` | Modal content container |
446
-
447
- ### Code
448
-
449
- | Class | Description |
450
- |-------|-------------|
451
- | `.dg-code-block` | Scrollable code block with monospace font |
452
- | `.dg-code-block--compact` | Reduced height |
453
- | `.dg-code-block--tall` | Increased height |
454
- | `.dg-code-block--no-scroll` | No scroll/height limit |
455
-
456
- ### Navigation
457
-
458
- | Class | Description |
459
- |-------|-------------|
460
- | `.dg-navbar` | Top navigation bar |
461
- | `.dg-link` | Styled link with hover effect |
462
- | `.dg-footer` | Page footer |
463
-
464
- ### Newsletter
465
-
466
- | Class | Description |
467
- |-------|-------------|
468
- | `.dg-newsletter-container` | Newsletter section container |
469
- | `.dg-newsletter-form` | Form with standard/compact/inline variants |
470
- | `.dg-newsletter-header` | Header with content and actions areas |
471
- | `.dg-logo-container` | Centered logo container |
472
- | `.dg-social-links` | Social links container |
473
- | `.dg-social-link` | Individual social link |
474
440
 
475
441
  ### Custom Utilities
476
442
 
477
443
  | Utility | Description |
478
444
  |---------|-------------|
479
- | `.dg-gradient-border` | Gradient border using brand colors (adaptive fill) |
480
- | `.dg-glow-cyan-green` | Box shadow glow with brand colors |
481
- | `.dg-bg-reset` | Reset background-image properties |
482
- | `.dg-shadow-subtle` | Subtle box shadow |
445
+ | `dg-gradient-border` | Gradient border using brand colors |
446
+ | `dg-glow-cyan-green` | Box shadow glow with brand colors |
447
+ | `dg-bg-reset` | Reset background-image (for hover states) |
448
+ | `dg-shadow-subtle` | Subtle box shadow |
483
449
 
484
450
  ---
485
451
 
486
- ## Responsive Design
452
+ ## Logo Assets
453
+
454
+ 12 SVG logos as package exports:
455
+
456
+ | Type | Adaptive | Light | Dark |
457
+ |------|----------|-------|------|
458
+ | Wordmark | `@deepgram/styles/logo/wordmark` | `@deepgram/styles/logo/wordmark-light` | `@deepgram/styles/logo/wordmark-dark` |
459
+ | Lettermark | `@deepgram/styles/logo/lettermark` | `@deepgram/styles/logo/lettermark-light` | `@deepgram/styles/logo/lettermark-dark` |
460
+ | Square | `@deepgram/styles/logo/lettermark-square` | `@deepgram/styles/logo/lettermark-square-light` | `@deepgram/styles/logo/lettermark-square-dark` |
461
+ | Circle | `@deepgram/styles/logo/lettermark-circle` | `@deepgram/styles/logo/lettermark-circle-light` | `@deepgram/styles/logo/lettermark-circle-dark` |
487
462
 
488
- All components are mobile-first with progressive breakpoints:
463
+ Adaptive variants use embedded `@media (prefers-color-scheme)` to switch automatically.
489
464
 
490
- - **Mobile** (default): Single column, stacked layouts
491
- - **Tablet** (`640px`): Two column layouts, expanded spacing
492
- - **Desktop** (`1024px`): Multi-column layouts, full features
465
+ ---
493
466
 
494
467
  ## Browser Support
495
468
 
496
- - Chrome, Firefox, Safari, Edge (latest 2 versions)
469
+ - Chrome 123+, Firefox 120+, Safari 17.5+, Edge 123+
497
470
  - Requires: CSS Grid, Flexbox, Custom Properties, `light-dark()` function
498
- - `light-dark()` is supported in Chrome 123+, Firefox 120+, Safari 17.5+
499
471
 
500
472
  ## License
501
473
 
502
474
  ISC
503
475
 
504
- ## Contributing
505
-
506
- See the [main repository](https://github.com/deepgram/dx-design) for contribution guidelines.
507
-
508
476
  ## Links
509
477
 
510
478
  - [Component Showcase](https://design.dx.deepgram.com) — Live preview of all components