Skip to content

Conversation

@ravisuhag
Copy link
Member

@ravisuhag ravisuhag commented Feb 1, 2026

Adds comprehensive theme documentation for Apsara design system, covering the theming system
overview and all design tokens.

Changes

New Theme Documentation Section

Created a new "Theme" section in the documentation with the following pages:

  • Overview (theme/overview/) - Documents the ThemeProvider component, useTheme hook, theme modes,
    style variants, accent colors, and gray color options
  • Colors (theme/colors/) - Documents semantic color tokens for foreground, background, border,
    overlay, and visualization colors
  • Typography (theme/typography/) - Documents font families, weights, body/title/mono sizes, line
    heights, and letter spacing
  • Spacing (theme/spacing/) - Documents the 17-step spacing scale (--rs-space-1 through
    --rs-space-17)
  • Radius (theme/radius/) - Documents border radius tokens with modern and traditional style
    variants
  • Effects (theme/effects/) - Documents shadow and blur effect tokens

Files Added

  apps/www/src/content/docs/theme/
  ├── meta.json
  ├── overview/
  │   ├── index.mdx
  │   └── props.ts
  ├── colors/
  │   └── index.mdx
  ├── typography/
  │   └── index.mdx
  ├── spacing/
  │   └── index.mdx
  ├── radius/
  │   └── index.mdx
  └── effects/
      └── index.mdx

Files Modified

  - apps/www/src/content/docs/meta.json - Added "theme" to navigation

Notes

  • All documentation uses Apsara's Table component for consistent styling
  • Props documentation uses pattern consistent with component docs
  • Token tables include descriptions and use cases for each token

Summary by CodeRabbit

  • New Features

    • TokenTable with visual previews and copy-to-clipboard for tokens
    • MDX-integrated token table rendering for docs
  • Documentation

    • Revamped Getting Started with multi-framework setup and examples
    • New Theme docs: overview, colors, spacing, radius, effects, typography
    • Updated docs navigation to surface Theme content
  • Style

    • Enhanced Markdown table styling and comprehensive token table UI styles (responsive, previews, hover states)

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Feb 4, 2026 5:04pm

Add a reusable TokenTable component with visual previews for different
token types (color, spacing, radius, shadow, blur) and copy-to-clipboard
functionality. Update all theme documentation to use the new component.
- Consolidate typography tables (body, title, mono) for better readability
- Remove redundant Style Comparison and Elevation Hierarchy sections
- Add Token Naming Convention section to overview
- Improve intro descriptions explaining semantic token behavior
- Add Usage section to spacing with practical examples
- Update all Usage sections with real-world patterns (dashboards,
  data tables, command palettes, etc.) instead of basic component styling
- Restructure overview with cleaner hierarchy (5 focused sections)
- Replace verbose bullet lists with concise formats
- Add use-case focused customization examples
- Improve API Reference with better explanations for ThemeProvider and useTheme
- Add markdown table styles matching TokenTable appearance
- Add CSS usage example showing how to use tokens
- Link token categories to their respective documentation pages
- Add comprehensive introduction page with value props, component overview,
  theming guide, and technology stack
- Expand getting started with prerequisites, framework setup guides for
  Next.js and Vite, and additional sections for icons and hooks imports
- Rename fliter-chip to filter-chip to fix directory name typo
- Document both semantic and scale token naming patterns in overview
- Update overlay colors to show actual rgba values instead of percentages for consistency with other token tables
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

 _______________________________________________________________________________________________________________
< Make quality a requirements issue. Involve your users in determining the project's real quality requirements. >
 ---------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

Tip

You can customize the tone of the review comments and chat replies.

Set the tone_instructions setting in your project's settings in CodeRabbit to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

📝 Walkthrough

Walkthrough

This change adds a new client-side TokenTable component (with styles and re-exports), integrates it into MDX components, introduces prose table CSS, and adds extensive theme documentation pages (overview, colors, effects, radius, spacing, typography) plus theme-related types and metadata updates.

Changes

Cohort / File(s) Summary
TokenTable component
apps/www/src/components/tokentable/tokentable.tsx, apps/www/src/components/tokentable/tokentable.module.css, apps/www/src/components/tokentable/index.ts
Adds a new TokenTable React component with TokenPreview variants (color, spacing, radius, shadow, blur), copy-to-clipboard UI, responsive styling, and exports types TokenType, TokenItem, TokenTableProps, plus re-exports via index.
MDX integration & table styles
apps/www/src/components/mdx/mdx-components.tsx, apps/www/src/components/mdx/mdx-components.module.css
Registers TokenTable in the MDX components map and adds .prose-table styling for Markdown tables; adjusts Table wrapper to apply the new prose table class.
Theme documentation content & metadata
apps/www/src/content/docs/theme/..., apps/www/src/content/docs/theme/meta.json
Adds a new Theme doc section with pages for overview, colors, effects, radius, spacing, and typography; includes many TokenTable usages and a theme meta file.
Docs: overview & getting-started
apps/www/src/content/docs/(overview)/index.mdx, apps/www/src/content/docs/(overview)/getting-started.mdx, apps/www/src/content/docs/meta.json
Expands the site overview and rewrites Getting Started into a multi-step guide with framework examples and next steps; updates docs navigation to include the theme section.
Theme types for docs
apps/www/src/content/docs/theme/overview/props.ts
Adds exported TypeScript types ThemeProviderProps and UseThemeProps used by the theme overview documentation.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant UI as TokenTable (React)
  participant CB as Clipboard API
  participant Tip as Tooltip/State

  User->>UI: Click copy button for a token
  UI->>CB: writeText("var(--token-name)")
  CB-->>UI: success / failure
  UI->>Tip: show "Copied!" feedback (2s) / show error
  Tip-->>User: visual confirmation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Poem

🐰 I hopped through tokens, tiny and neat,
Colors and radii lined up so sweet,
I clicked to copy, a cheery small chime,
Previews and docs — a garden in time,
Nibbles of CSS, delights to repeat. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main objective: creating comprehensive documentation for Apsara design tokens with a new Theme section covering colors, typography, spacing, radius, and effects.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch token-docs

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Fix all issues with AI agents
In `@apps/www/src/components/tokentable/tokentable.tsx`:
- Around line 49-55: Add an explicit type='button' to the copy button and guard
clipboard availability: detect clipboard support (e.g., check typeof navigator
!== 'undefined' && navigator.clipboard && typeof navigator.clipboard.writeText
=== 'function') in the Tokentable component (where handleCopy is defined),
disable the button and adjust aria attributes when unsupported, and have
handleCopy early-return if the clipboard API is unavailable; this prevents
accidental form submission and avoids enabling the button in environments that
don't support navigator.clipboard.
- Around line 36-47: The CopyButton component's setTimeout can run after unmount
and cause state updates on an unmounted component; modify CopyButton to use a
ref (e.g., timeoutRef) to store the timeout id, clear any existing timeout
before creating a new one, and add a useEffect cleanup that clears
timeoutRef.current on unmount; update the handleCopy logic in CopyButton to
clear timeoutRef.current before calling setTimeout and assign the id to
timeoutRef.current so it can be cancelled in the cleanup.

In `@apps/www/src/content/docs/`(overview)/getting-started.mdx:
- Around line 35-52: Remove the duplicate stylesheet import from the Step 2
snippet: keep only the ThemeProvider import and usage (import { ThemeProvider }
from "@raystack/apsara"; and the ThemeProvider wrapper around <YourApp />),
since the global stylesheet import (import "@raystack/apsara/style.css") is
already shown in Step 1 and should only be included once at the app root; update
the Step 2 code block to omit the redundant import and ensure the documentation
text still notes that the stylesheet is required at the application root.
- Around line 132-158: The two examples render the Button component but don't
import it; update both snippets to import Button alongside the other named
exports (e.g., add Button to the import list where
MagnifyingGlassIcon/Cross2Icon are imported and where useTheme is used), so that
the icons example (MagnifyingGlassIcon, Cross2Icon) and the hooks example
(ThemeToggle using useTheme) include an import like import { Button, ... } from
"@raystack/apsara" to make the snippets complete and runnable.

In `@apps/www/src/content/docs/`(overview)/index.mdx:
- Line 14: The phrase "Production ready" in the sentence starting with that
phrase should be hyphenated as "Production-ready" when used as a compound
adjective before a noun; update the text in
apps/www/src/content/docs/(overview)/index.mdx replacing "Production ready —
Components are designed..." with "Production-ready — Components are designed..."
so the compound adjective is grammatically correct.

In `@apps/www/src/content/docs/theme/overview/props.ts`:
- Line 72: The file uses the type React.ReactNode for the children prop but
never imports React; add an import from 'react' to satisfy the type usage
(either add "import React from 'react'" or "import type { ReactNode } from
'react'" and change the prop to use ReactNode) so that the declaration
"children?: React.ReactNode;" in props.ts compiles.
🧹 Nitpick comments (4)
apps/www/src/components/mdx/mdx-components.tsx (1)

124-126: Consider applying consistent className handling.

The TypeTable component (lines 118-123) merges a prose-specific className, but TokenTable passes props through without applying any additional styling. This may be intentional if TokenTable handles its own styling, but worth confirming consistency is desired.

♻️ Optional: Apply consistent className pattern

If TokenTable should also receive prose-specific styling:

-  TokenTable: (props: ComponentPropsWithoutRef<typeof TokenTable>) => (
-    <TokenTable {...props} />
-  ),
+  TokenTable: (props: ComponentPropsWithoutRef<typeof TokenTable>) => (
+    <TokenTable
+      {...props}
+      className={cx(styles['prose-type-table'], props.className)}
+    />
+  ),
apps/www/src/content/docs/theme/overview/props.ts (1)

33-33: Type union is redundant but documents intent.

string | 'class' is technically redundant since 'class' is a subtype of string. However, it does communicate that 'class' is a common/expected value. Consider using a more explicit union if specific values are preferred:

♻️ Optional: More explicit type
-  attribute?: string | 'class';
+  attribute?: 'class' | 'data-theme' | (string & {});

The (string & {}) pattern preserves autocomplete for the literal types while still accepting any string.

apps/www/src/content/docs/theme/colors/index.mdx (1)

101-125: Consider adding more descriptive use cases for overlay tokens.

The overlay token descriptions are generic ("Black overlay", "White overlay"). While the alpha values are self-explanatory, consider adding context about typical use cases to help developers choose the right opacity level.

For example:

  • a1-a3: Subtle overlays, disabled states
  • a4-a6: Modal backdrops (light dimming)
  • a7-a9: Strong overlays, image darkening
  • a10-a12: Near-opaque overlays
apps/www/src/components/tokentable/tokentable.module.css (1)

229-255: Responsive styles may need to include wide cell variants.

The responsive media query updates .previewCell and .tokenCell but doesn't include .previewCellWide and .tokenCellWide variants defined in lines 84-104. If these variants are used, they may not respond correctly on mobile.

♻️ Proposed fix to include wide variants in responsive styles
 `@media` (max-width: 768px) {
   .header {
     display: none;
   }

   .row {
     flex-direction: column;
     align-items: flex-start;
     gap: var(--rs-space-2);
     padding: var(--rs-space-4);
   }

   .previewCell,
+  .previewCellWide,
   .tokenCell,
+  .tokenCellWide,
   .valueCell,
   .descriptionCell {
     width: 100%;
   }

-  .previewCell {
+  .previewCell,
+  .previewCellWide {
     justify-content: flex-start;
   }

   .copyButton {
     opacity: 1;
   }
 }

- Change TokenTable value column from fixed width to min-width for better adaptability
- Move overlay opacity values to descriptions for consistency with other color sections
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/www/src/components/tokentable/tokentable.module.css`:
- Around line 137-160: The copy button is only revealed on row hover, so
keyboard users can tab to an invisible control; update the CSS selectors around
.copyButton and .row to also reveal and style the control on keyboard focus: add
rules for .copyButton:focus-visible and .row:focus-within .copyButton to set
opacity: 1 and provide a visible focus ring (e.g., outline or box-shadow with
appropriate outline-offset and border-radius) and ensure the focus ring
contrasts with background; keep existing hover styles for mouse users and reuse
the --rs-radius-2 variable for consistent rounding.
🧹 Nitpick comments (3)
apps/www/src/content/docs/theme/colors/index.mdx (3)

93-126: Overlay opacity scale is non-linear.

The opacity progression jumps from 20% (a4) to 30% (a5), then continues in 10% increments. If this is intentional for design purposes, consider adding a brief note explaining the scale rationale to help users choose the appropriate overlay level.


128-150: Consider documenting the full visualization color scale or clarifying the "-9" suffix.

All visualization tokens use the "-9" suffix, suggesting a larger color scale exists (likely steps 1-12). Consider either:

  1. Adding a note explaining why "-9" is the recommended variant for data visualization
  2. Documenting additional scale steps if they're available for use cases requiring lighter/darker variants

223-228: Solid best practices with room for accessibility enhancement.

The guidelines are practical and well-articulated. Consider adding a best practice about ensuring sufficient color contrast ratios (WCAG AA/AAA) when combining foreground and background tokens, especially for text readability.

📝 Suggested addition
 - **Use semantic tokens** - Prefer semantic color tokens over raw color values for consistency and theming support
 - **Match foreground with background** - Use corresponding foreground colors when placing text on semantic backgrounds (e.g., `foreground-accent-emphasis` on `background-accent-emphasis`)
 - **Respect color hierarchy** - Use primary colors for main content, secondary for supporting content, and tertiary for subtle elements
 - **Test in both themes** - Ensure your color choices work well in both light and dark modes
+- **Ensure sufficient contrast** - Verify that text and interactive elements meet WCAG contrast requirements (4.5:1 for normal text, 3:1 for large text)

- Replace custom CopyButton with Apsara's CopyButton component in TokenTable
- Remove duplicate stylesheet import from ThemeProvider example
- Add missing Button imports to icons and hooks examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants