-
Notifications
You must be signed in to change notification settings - Fork 6
Bcc tokens 2.0 #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Bcc tokens 2.0 #347
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,84 +1,39 @@ | ||
| --- | ||
| sectionTitle: Design | ||
| sectionTitle: BCC Tokens 2.0 | ||
| --- | ||
|
|
||
| # BCC Design System | ||
| # BCC Tokens 2.0 | ||
|
|
||
| Build consistent BCC applications with design tokens and components. | ||
| Design tokens for building consistent BCC applications. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Install the package: | ||
|
|
||
| ```bash | ||
| npm install @bcc-code/design-tokens | ||
| ``` | ||
|
|
||
| Import in your CSS: | ||
|
|
||
| ```css | ||
| @import "@bcc-code/design-tokens/tailwind"; | ||
| ``` | ||
|
|
||
| Use in your HTML: | ||
|
|
||
| ```html | ||
| <div class="bg-elevation-surface-default text-default p-200 radius-md"> | ||
| Your content | ||
| </div> | ||
| ``` | ||
|
|
||
| That's it. You now have access to all BCC design tokens as Tailwind classes. | ||
|
|
||
| ## Packages | ||
|
|
||
| | Package | What it does | Install | | ||
| |---------|--------------|---------| | ||
| | [@bcc-code/design-tokens](./tokens/) | Colors, typography, spacing as CSS/Tailwind | `npm i @bcc-code/design-tokens` | | ||
| | [@bcc-code/icons-vue](./assets/icons/) | 200+ Vue 3 icon components | `npm i @bcc-code/icons-vue` | | ||
| | [Logo assets](./assets/logos.md) | CDN-hosted BCC logos | No install needed | | ||
|
|
||
| ## Common Examples | ||
|
|
||
| ### Card with proper spacing | ||
|
|
||
| ```html | ||
| <div class="bg-elevation-surface-default p-300 radius-lg shadow-sm"> | ||
| <h2 class="text-heading-md text-default">Card Title</h2> | ||
| <p class="text-body-md text-secondary mt-100">Card content goes here.</p> | ||
| </div> | ||
| ``` | ||
|
|
||
| ### Button with brand colors | ||
|
|
||
| ```html | ||
| <button class="bg-interactive-brand text-on-interactive px-300 py-100 radius-md"> | ||
| Click me | ||
| </button> | ||
| ``` | ||
|
|
||
| ### Using an icon | ||
|
|
||
| ```vue | ||
| <script setup> | ||
| import { HomeIcon } from '@bcc-code/icons-vue' | ||
| </script> | ||
|
|
||
| <template> | ||
| <HomeIcon class="w-6 h-6 text-default" /> | ||
| </template> | ||
| ``` | ||
|
|
||
| ## Next Steps | ||
| ## Documentation | ||
|
|
||
| - **[Design Tokens](./tokens/)** - Full token reference and setup options | ||
| - **[Guidelines](./tokens/guidelines.md)** - Do's and don'ts for using the system | ||
| - **[Icons](./assets/icons/)** - Browse available icons | ||
| | Section | Description | | ||
| |---------|-------------| | ||
| | [Getting Started](./getting-started/) | Installation and setup guides | | ||
| | [Core Concepts](./core-concepts/) | Colors, spacing, typography, dark mode | | ||
| | [Assets](./assets/) | Icons and logos | | ||
|
|
||
| ## Resources | ||
|
|
||
| | Resource | Link | | ||
| |----------|------| | ||
| | Figma tokens | [BCC Foundation - Master](https://www.figma.com/file/jtWn3ebee6bJnWpfZrJzq1/BCC-Foundation---Master) | | ||
| | Figma | [BCC Foundation - Master](https://www.figma.com/file/jtWn3ebee6bJnWpfZrJzq1/BCC-Foundation---Master) | | ||
| | npm | [@bcc-code/design-tokens](https://www.npmjs.com/package/@bcc-code/design-tokens) | | ||
| | GitHub | [bcc-code/bcc-design](https://github.com/bcc-code/bcc-design) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| --- | ||
| sectionTitle: Assets | ||
| sectionOrder: 40 | ||
| sectionOrder: 30 | ||
| --- | ||
|
|
||
| # Assets | ||
|
|
||
| Brand assets for BCC applications. | ||
| Visual assets for BCC applications. | ||
|
|
||
| - [Icons](./icons/) - SVG icons based on Material Symbols | ||
| - [Logos](./logos.md) - CDN-hosted logo assets | ||
| - [Icons](./icons.md) - SVG icon library | ||
| - [Logos](./logos.md) - CDN-hosted logo files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| sectionTitle: Core Concepts | ||
| sectionOrder: 20 | ||
| --- | ||
|
|
||
| # Core Concepts | ||
|
|
||
| Learn how to use BCC design tokens effectively. | ||
|
|
||
| - [Colors](./colors.md) - Semantic color tokens | ||
| - [Spacing](./spacing.md) - Consistent spacing scale | ||
| - [Typography](./typography.md) - Fonts and text styles | ||
| - [Dark Mode](./dark-mode.md) - Theme switching | ||
| - [Guidelines](./guidelines.md) - Do's and don'ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| --- | ||
| title: Colors | ||
| order: 1 | ||
| --- | ||
|
|
||
| # Colors | ||
|
|
||
| Use semantic color tokens instead of hardcoded values. Semantic tokens automatically adapt to light and dark modes. | ||
|
|
||
| ## Text Colors | ||
|
|
||
| | Token | CSS Variable | Tailwind Class | | ||
| |-------|--------------|----------------| | ||
| | Default | `--color-text-default` | `text-default` | | ||
| | Subtle | `--color-text-subtle` | `text-subtle` | | ||
| | Subtlest | `--color-text-subtlest` | `text-subtlest` | | ||
| | Disabled | `--color-text-disabled` | `text-disabled` | | ||
| | Inverse | `--color-text-inverse` | `text-inverse` | | ||
| | Brand | `--color-text-brand-default` | `text-brand-default` | | ||
| | Success | `--color-text-success` | `text-success` | | ||
| | Danger | `--color-text-danger` | `text-danger` | | ||
| | Warning | `--color-text-warning-default` | `text-warning-default` | | ||
| | Information | `--color-text-information` | `text-information` | | ||
|
|
||
| ## Background Colors | ||
|
|
||
| | Token | CSS Variable | Tailwind Class | | ||
| |-------|--------------|----------------| | ||
| | Surface Default | `--color-elevation-surface-default` | `bg-elevation-surface-default` | | ||
| | Surface Raised | `--color-elevation-surface-raised` | `bg-elevation-surface-raised` | | ||
| | Surface Overlay | `--color-elevation-surface-overlay` | `bg-elevation-surface-overlay` | | ||
| | Surface Sunken | `--color-elevation-surface-sunken` | `bg-elevation-surface-sunken` | | ||
|
|
||
| ## Border Colors | ||
|
|
||
| | Token | CSS Variable | Tailwind Class | | ||
| |-------|--------------|----------------| | ||
| | Default | `--color-border-default` | `border-default` | | ||
| | Subtle | `--color-border-subtle` | `border-subtle` | | ||
| | Bold | `--color-border-bold` | `border-bold` | | ||
|
|
||
| ## Interactive Colors | ||
|
|
||
| | Token | CSS Variable | Tailwind Class | | ||
| |-------|--------------|----------------| | ||
| | Primary | `--color-interactive-primary` | `bg-interactive-primary` | | ||
| | Primary Hover | `--color-interactive-primary-hover` | `bg-interactive-primary-hover` | | ||
| | On Interactive | `--color-text-on-interactive` | `text-on-interactive` | | ||
|
|
||
| ## Example | ||
|
|
||
| ```html | ||
| <div class="bg-elevation-surface-default border border-default text-default p-200"> | ||
| <p class="text-subtle">Secondary text</p> | ||
| <button class="bg-interactive-primary text-on-interactive px-200 py-100 rounded-md"> | ||
| Action | ||
| </button> | ||
| </div> | ||
| ``` | ||
|
|
||
| ## Do's and Don'ts | ||
|
|
||
| | Do | Don't | Why | | ||
| |----|-------|-----| | ||
| | `text-default` | `text-gray-900` | Adapts to dark mode | | ||
| | `text-subtle` | `text-gray-600` | Maintains contrast | | ||
| | `bg-elevation-surface-default` | `bg-white` | Theme-aware | | ||
| | `border-default` | `border-gray-200` | Consistent | | ||
|
|
||
| ## Accent Colors | ||
|
|
||
| For specific accent needs, semantic accent tokens are available: | ||
|
|
||
| - `text-accent-gray-default`, `text-accent-gray-bold` | ||
| - `text-accent-blue-default`, `text-accent-blue-bold` | ||
| - `text-accent-teal-default`, `text-accent-teal-bold` | ||
| - `text-accent-green-default`, `text-accent-green-bold` | ||
| - `text-accent-yellow-default`, `text-accent-yellow-bold` | ||
| - `text-accent-orange-default`, `text-accent-orange-bold` | ||
| - `text-accent-red-default`, `text-accent-red-bold` | ||
| - `text-accent-magenta-default`, `text-accent-magenta-bold` | ||
| - `text-accent-purple-default`, `text-accent-purple-bold` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| title: Dark Mode | ||
| order: 4 | ||
| --- | ||
|
|
||
| # Dark Mode | ||
|
|
||
| All semantic tokens automatically adapt to dark mode. No additional configuration needed. | ||
|
|
||
| ## Enable Dark Mode | ||
|
|
||
| Add the `dark` class to your HTML element: | ||
|
|
||
| ```html | ||
| <html class="dark"> | ||
| ``` | ||
|
|
||
| ## Toggle Programmatically | ||
|
|
||
| ```js | ||
| // Toggle dark mode | ||
| document.documentElement.classList.toggle("dark"); | ||
|
|
||
| // Check current mode | ||
| const isDark = document.documentElement.classList.contains("dark"); | ||
| ``` | ||
|
|
||
| ## PrimeVue Setup | ||
|
|
||
| If using PrimeVue, configure the dark mode selector: | ||
|
|
||
| ```js | ||
| app.use(PrimeVue, { | ||
| theme: { | ||
| preset: BCCPreset, | ||
| options: { darkModeSelector: ".dark" }, | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| Always test components in both light and dark modes. Hardcoded colors break dark mode. | ||
|
|
||
| ```html | ||
| <!-- Wrong: breaks in dark mode --> | ||
| <div class="bg-white text-black shadow-lg"> | ||
|
|
||
| <!-- Right: works in both modes --> | ||
| <div class="bg-elevation-surface-raised text-default shadow-md"> | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| title: Guidelines | ||
| order: 5 | ||
| --- | ||
|
|
||
| # Guidelines | ||
|
|
||
| Best practices for using BCC Design Tokens. | ||
|
|
||
| ## Components | ||
|
|
||
| Use PrimeVue with the BCC preset. Building from scratch creates inconsistency. | ||
|
|
||
| | Do | Don't | | ||
| |----|-------| | ||
| | Use PrimeVue components | Build custom components from scratch | | ||
| | Apply BCC preset first | Start with unstyled components | | ||
| | Extend existing components | Fork and modify component source | | ||
| | Override specific tokens | Override all component styles | | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| ### Mixing Token Systems | ||
|
|
||
| Never mix BCC tokens with default Tailwind classes. | ||
|
|
||
| ```html | ||
| <!-- Wrong: mixing systems --> | ||
| <div class="p-4 text-default bg-white border-gray-200"> | ||
|
|
||
| <!-- Right: all BCC tokens --> | ||
| <div class="p-200 text-default bg-elevation-surface-default border-default"> | ||
| ``` | ||
|
|
||
| ### Hardcoding Colors in CSS | ||
|
|
||
| Use CSS custom properties instead of hex values. | ||
|
|
||
| ```css | ||
| /* Wrong */ | ||
| .card { | ||
| background: #ffffff; | ||
| color: #1a1a1a; | ||
| } | ||
|
|
||
| /* Right */ | ||
| .card { | ||
| background: var(--color-elevation-surface-default); | ||
| color: var(--color-text-default); | ||
| } | ||
| ``` | ||
|
|
||
| ## When to Use Custom Values | ||
|
|
||
| Custom values are acceptable in specific situations. | ||
|
|
||
| | Situation | Approach | Example | | ||
| |-----------|----------|---------| | ||
| | One-off layout dimensions | Tailwind arbitrary values | `w-[347px]` | | ||
| | Animation timing | Define in component styles | `transition: 200ms` | | ||
| | Third-party library | Match their API, wrap with tokens | Use tokens for colors | | ||
|
|
||
| If using the same custom value more than twice, request it as a token. | ||
|
|
||
| ## Checklist | ||
|
|
||
| Before submitting code: | ||
|
|
||
| - [ ] No hardcoded color values (`#fff`, `white`, `gray-900`) | ||
| - [ ] No default Tailwind spacing (`p-4`, `m-2`, `gap-6`) | ||
| - [ ] All colors use semantic tokens (`text-default`, `bg-elevation-*`) | ||
| - [ ] Component works in dark mode | ||
| - [ ] Using PrimeVue components where available |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be an idea to show the tokens visually too?
You can embed a Vue component which will be rendered as part of the documentaiton
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Planning to take it on the next update.