Skip to content

Commit ade5c05

Browse files
Update core/src/utils/theme.ts
Co-authored-by: Brandy Smith <[email protected]>
1 parent 0d6bd9d commit ade5c05

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

core/src/utils/theme.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,29 @@ export const applyGlobalTheme = (baseTheme: any, userTheme?: any): any => {
350350
* Generates component's themed CSS class with CSS variables
351351
* from its theme object
352352
* @param componentTheme The component's object to generate CSS for (e.g., IonChip { })
353-
* @param componentName The component name without any prefixes (e.g., 'chip')
353+
* @param components An object mapping component names (e.g. `IonChip`) to a nested
354+
* design-token configuration. Each configuration can contain arbitrary levels of
355+
* token groups (such as `size`, `state`, `shape`, `variant`, etc.), where leaf values
356+
* are CSS-compatible values. The structure is recursively flattened into CSS custom
357+
* properties using kebab-case keys and an `--ion-<component>-` prefix.
358+
*
359+
* Example:
360+
* ```json
361+
* {
362+
* IonChip: {
363+
* size: { small: { height: "24px" } },
364+
* state: { disabled: { opacity: "0.4" } }
365+
* }
366+
* }
367+
* ```
368+
*
369+
* Becomes:
370+
* ```css
371+
* :root ion-chip {
372+
* --ion-chip-size-small-height: 24px;
373+
* --ion-chip-state-disabled-opacity: 0.4;
374+
* }
375+
* ```
354376
* @returns string containing the component's themed CSS variables
355377
*/
356378
export const generateComponentsThemeCSS = (components: any): string => {

0 commit comments

Comments
 (0)