@@ -4,50 +4,150 @@ The Design System forged in the fires of open-source development
44
55Demo: https://cdx-ui.vercel.app/
66
7- - [ ] Make tree-shaking work
7+ - [x ] Make tree-shaking work
88- [ ] Test Web/React/Native implementations
99- [ ] Think about i18n
1010
11- ## Access Vue components
11+ ## Installation
1212
13- ``` ts
14- import { Button , Input , Heading } from ' @codexteam/ui/vue' ;
13+ ``` bash
14+ npm install @codexteam/ui
15+ # or
16+ yarn add @codexteam/ui
1517```
1618
19+ ## Quick Start
20+
21+ ### 1. Import Base Styles (Required)
22+
23+ ``` typescript
24+ // main.ts
25+ import ' @codexteam/ui/styles' ;
26+ ```
27+
28+ ### 2. Import Fonts (Optional)
29+
30+ Fonts are ** optional** and are ** not** loaded by default. If you want to use the bundled ** Inter** and ** JetBrains Mono** fonts, import them explicitly:
31+
32+ ``` typescript
33+ // main.ts
34+ import ' @codexteam/ui/styles/fonts' ;
35+ ```
36+
37+ If you don't import fonts, typography will fall back to system fonts.
38+
39+ ### 3. Import Themes (Tree-shakeable)
40+
41+ Import only the themes you need - others will NOT be included in the bundle:
42+
43+ ``` typescript
44+ import ' @codexteam/ui/styles/themes/pure' ;
45+ import ' @codexteam/ui/styles/themes/grass' ;
46+ ```
47+
48+ ** Available themes:** ` graphite ` , ` crimson ` , ` red ` , ` violet ` , ` grass ` , ` amber ` , ` pure ` , ` sky `
49+
50+ ### 4. Import Components (Tree-shakeable)
51+
52+ ``` typescript
53+ import { Button , Avatar , Heading } from ' @codexteam/ui/vue' ;
54+ ```
55+
56+ ### 5. Apply Theme in Template
57+
1758``` vue
18- <Heading :level="2">
19- CodeX UI showcase
20- </Heading>
21- <Button text="Button text" />
22- <Input text="Input text" />
59+ <template>
60+ <div color-scheme="light" theme-accent="pure" theme-base="grass">
61+ <Button>Click me</Button>
62+ </div>
63+ </template>
64+ ```
65+
66+ ## Complete Example
67+
68+ ** main.ts:**
69+ ``` typescript
70+ import { createApp } from ' vue' ;
71+ import App from ' ./App.vue' ;
72+
73+ // Base styles (required)
74+ import ' @codexteam/ui/styles' ;
75+
76+ // Fonts (optional)
77+ import ' @codexteam/ui/styles/fonts' ;
78+
79+ // Themes (import only what you need)
80+ import ' @codexteam/ui/styles/themes/pure' ;
81+ import ' @codexteam/ui/styles/themes/grass' ;
82+
83+ createApp (App ).mount (' #app' );
84+ ```
85+
86+ ** App.vue:**
87+ ``` vue
88+ <script setup lang="ts">
89+ import { Button, Heading, Input } from '@codexteam/ui/vue';
90+ </script>
91+
92+ <template>
93+ <div color-scheme="light" theme-accent="pure" theme-base="grass">
94+ <Heading :level="2">CodeX UI showcase</Heading>
95+ <Button>Button text</Button>
96+ <Input placeholder="Input text" />
97+ </div>
98+ </template>
2399```
24100
25101## Types for Vue Components
26102
27103Add the following "path" to the "tsconfig.json"
28104
29- ```
105+ ``` json
30106{
31107 "compilerOptions" : {
32108 "paths" : {
33- "@codexteam/ui/vue": ["../@codexteam/ui/dist/types/vue/index.d.ts"],
109+ "@codexteam/ui/vue" : [" ../@codexteam/ui/dist/types/vue/index.d.ts" ]
34110 }
35- },
111+ }
36112}
37-
38113```
39114
40115## Build Design System
41116Build the design system to be able to use the @codexteam/ui /styles import
42117
43- ```
118+ ``` bash
44119yarn build
45120```
46121
47- ## Access CSS variables
122+ ## Custom Theming
123+
124+ If you don't want to use built-in themes, define your own CSS variables:
125+
126+ ``` css
127+ :root {
128+ /* Base colors */
129+ --base--bg-primary : #ffffff ;
130+ --base--bg-secondary : #f5f5f5 ;
131+ --base--bg-secondary-hover : #eeeeee ;
132+ --base--border : #e0e0e0 ;
133+ --base--text : #333333 ;
134+ --base--text-secondary : #666666 ;
135+ --base--solid : #000000 ;
136+ --base--text-solid-foreground : #ffffff ;
137+
138+ /* Accent colors */
139+ --accent--solid : #2196f3 ;
140+ --accent--solid-hover : #1976d2 ;
141+ --accent--bg-secondary : #e3f2fd ;
142+ --accent--text-solid-foreground : #ffffff ;
143+ }
144+ ```
145+
146+ ## Access CSS Variables
48147
49- 1 . Import ` @codexteam/ui/styles ` somewhere in App
50- 2 . Use variable in CSS, e.g ` var(--ui-color) `
148+ 1 . Import ` @codexteam/ui/styles ` in your app
149+ 2 . Import themes you need (e.g., ` @codexteam/ui/styles/themes/pure ` )
150+ 3 . Use variables in CSS: ` var(--base--text) ` , ` var(--accent--solid) `
51151
52152## Using Typography
53153
0 commit comments