Skip to content

Conversation

@kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented May 10, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced documentation for Avatar, AvatarGroup, Callout, Progress, Switch, and ToggleGroup components with more granular API tables and example usage components.
    • Introduced new example components for BlockQuote, Callout, Progress, Switch, and ToggleGroup, improving clarity in documentation.
  • Refactor

    • Updated composition patterns for Avatar, AvatarGroup, Callout, Progress, Switch, and ToggleGroup components in documentation to use explicit subcomponents and clearer structure.
    • Replaced inline code examples and styles in documentation with dynamically loaded external source files.
  • Documentation

    • Added detailed API documentation files for multiple components and their subcomponents, providing clearer property descriptions and usage.
    • Improved visual presentation of features and API tables in documentation.
  • Style

    • Enhanced the appearance of feature lists in documentation with icons and improved spacing.
  • Chores

    • Updated dependency version for "@radui/ui" to "^0.0.39".

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 10, 2025

Walkthrough

This update restructures several UI component documentation pages and examples, transitioning from monolithic or prop-driven APIs to a composable, compound component pattern. It introduces new API documentation files, updates example usages, and refactors code to load external source files for examples and API tables. Minor internal component improvements and dependency updates are also included.

Changes

Files/Group Change Summary
docs/app/docs/components/avatar-group/docs/avatarGroup_anatomy.tsx,
docs/app/docs/components/avatar-group/docs/example_1.tsx,
docs/app/docs/components/avatar-group/page.mdx
Refactored AvatarGroup examples and documentation to use a composable API with Root, Item, Avatar, and Fallback subcomponents; updated usage patterns and documentation tables.
docs/app/docs/components/avatar/docs/AvatarExample.tsx,
docs/app/docs/components/avatar/page.mdx
Refactored Avatar example and documentation to use explicit subcomponents (Root, Image, Fallback); updated API tables.
docs/app/docs/components/callout/examples/CalloutColor.tsx,
docs/app/docs/components/callout/examples/CalloutSizes.tsx,
docs/app/docs/components/callout/examples/CalloutVariants.tsx,
docs/app/docs/components/callout/examples/CalloutExample.tsx,
docs/app/docs/components/callout/page.mdx
Refactored Callout examples to use compound components (Root, Icon, Text); updated example usage and documentation structure.
docs/app/docs/components/progress/docs/examples/ProgressExample.tsx,
docs/app/docs/components/progress/page.mdx
Added new Progress example using Root and Indicator subcomponents; updated documentation to separate API tables for each.
docs/app/docs/components/switch/docs/examples/SwitchExample.tsx,
docs/app/docs/components/switch/page.mdx
Added new Switch example using Root and Thumb subcomponents; updated documentation to separate API tables for each.
docs/app/docs/components/toggle-group/docs/examples/ToggleGroupExample.tsx,
docs/app/docs/components/toggle-group/page.mdx
Added new ToggleGroup example using Root and Item subcomponents; updated documentation to separate API tables for each.
docs/app/docs/components/blockquote/examples/BlockQuoteExample.tsx,
docs/app/docs/components/blockquote/page.mdx
Added BlockQuote example component and updated hero section to use it.
docs/app/docs/components/avatar-group/docs/codeUsage.js,
docs/app/docs/components/avatar/docs/codeUsage.js,
docs/app/docs/components/blockquote/docs/codeUsage.js,
docs/app/docs/components/button/docs/codeUsage.js,
docs/app/docs/components/card/docs/codeUsage.js,
docs/app/docs/components/code/docs/codeUsage.js,
docs/app/docs/components/em/docs/codeUsage.js,
docs/app/docs/components/heading/docs/codeUsage.js,
docs/app/docs/components/kbd/docs/codeUsage.js,
docs/app/docs/components/progress/docs/codeUsage.js,
docs/app/docs/components/separator/docs/codeUsage.js,
docs/app/docs/components/strong/docs/codeUsage.js,
docs/app/docs/components/switch/docs/codeUsage.js,
docs/app/docs/components/text/docs/codeUsage.js,
docs/app/docs/components/toggle-group/docs/codeUsage.js,
docs/app/docs/components/tooltip/docs/codeUsage.js
Refactored code usage files to load example and API documentation source code from external files; updated import paths and API documentation exports to match new subcomponent structure.
docs/app/docs/components/avatar-group/docs/component_api/avatar.tsx,
docs/app/docs/components/avatar-group/docs/component_api/fallback.tsx,
docs/app/docs/components/avatar-group/docs/component_api/item.tsx,
docs/app/docs/components/avatar-group/docs/component_api/root.tsx,
docs/app/docs/components/avatar/docs/component_api/fallback.tsx,
docs/app/docs/components/avatar/docs/component_api/image.tsx,
docs/app/docs/components/avatar/docs/component_api/root.tsx,
docs/app/docs/components/callout/docs/component_api/callout_icon.tsx,
docs/app/docs/components/callout/docs/component_api/root.tsx,
docs/app/docs/components/callout/docs/component_api/text.tsx,
docs/app/docs/components/progress/docs/component_api/indicator.tsx,
docs/app/docs/components/progress/docs/component_api/root.tsx,
docs/app/docs/components/switch/docs/component_api/root.tsx,
docs/app/docs/components/switch/docs/component_api/thumb.tsx,
docs/app/docs/components/toggle-group/docs/component_api/item.tsx,
docs/app/docs/components/toggle-group/docs/component_api/root.tsx
Added or updated API documentation data files for subcomponents, detailing props, types, and usage for documentation tables.
docs/components/layout/Documentation/helpers/ComponentFeatures/ComponentFeatures.js Enhanced feature list styling with tick icons and improved layout.
docs/components/layout/Documentation/helpers/DocsTable.js Updated EnumRenderer to default enumValues to an empty array, preventing errors.
src/components/ui/Avatar/fragments/AvatarFallback.tsx Extended AvatarFallback props to accept className; updated signature and class merging logic.
src/components/ui/Avatar/fragments/AvatarImage.tsx Simplified props destructuring by removing unused children prop.
src/components/ui/AvatarGroup/fragments/AvatarGroupRoot.tsx,
src/components/ui/Callout/fragments/CalloutRoot.tsx
Set default values for className and related props to empty strings, ensuring consistent string handling.
src/components/ui/Callout/Callout.tsx Removed unused COMPONENT_NAME constant and displayName assignment.
src/components/ui/Progress/stories/Progress.stories.tsx Removed a console log statement from story render function.
styles/themes/components/switch.scss Added a blank line after a style declaration for formatting.
docs/app/docs/components/callout/docs/api/callout.tsx Removed obsolete Callout API documentation file.
docs/package.json Updated @radui/ui dependency from ^0.0.38 to ^0.0.39.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DocsPage
  participant ExampleComponent
  participant APIData

  User->>DocsPage: Navigates to component docs
  DocsPage->>ExampleComponent: Renders usage example (imported)
  DocsPage->>APIData: Loads API documentation data (imported)
  DocsPage->>User: Displays hero example and API tables
Loading

Possibly related PRs

  • rad-ui/ui#716: Adds initial AvatarGroup documentation files and examples; related as both PRs update AvatarGroup documentation and examples.
  • rad-ui/ui#425: Introduces AvatarGroup component and root fragment; related as both PRs modify AvatarGroup's structure and usage.
  • rad-ui/ui#1085: Standardizes component APIs to composable patterns for AvatarGroup and others; directly related due to similar refactoring.

Suggested labels

automerge

Suggested reviewers

  • GoldGroove06

Poem

The docs have grown, the code refined,
Components now are well-aligned.
From roots to thumbs, each part defined,
With tick-marked lists and docs combined.
A bunny hops through code so bright—
“Compose your UI, and get it right!”
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

docs/app/docs/components/callout/docs/codeUsage.js

Oops! Something went wrong! :(

ESLint: 8.56.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/docs/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

docs/app/docs/components/callout/docs/component_api/callout_icon.tsx

Oops! Something went wrong! :(

ESLint: 8.56.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/docs/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 19

🔭 Outside diff range comments (2)
docs/app/docs/components/callout/docs/codeUsage.js (1)

39-48: 💡 Verification agent

🧩 Analysis chain

Consider removing or updating legacy table export

The calloutTable is kept for backward compatibility but only contains a single property definition, which seems incomplete. Either remove it if it's no longer needed or update it to match the new API structure.


🏁 Script executed:

#!/bin/bash
# Check if this legacy table is still being referenced anywhere
echo "Checking for references to calloutTable in the codebase..."
rg "calloutTable" --type js --type jsx --type ts --type tsx

Length of output: 214


Let's widen the search to all files to ensure we catch any references:


🏁 Script executed:

#!/bin/bash
echo "Searching for any references to calloutTable across the repo..."
rg "calloutTable" -n .

Length of output: 245


Remove unused legacy calloutTable export

The calloutTable definition in
docs/app/docs/components/callout/docs/codeUsage.js
is not referenced anywhere in the repository. You can safely delete this export (and any related imports) to clean up dead code.

docs/app/docs/components/avatar/docs/codeUsage.js (1)

28-41: 💡 Verification agent

🧩 Analysis chain

Consider deprecating or removing avatarBasicUsageExample.

Since you're now using the more detailed API documentation in api_documentation, consider either removing the avatarBasicUsageExample object or adding a deprecation comment if it's still needed for backward compatibility.


🏁 Script executed:

#!/bin/bash
# Check if avatarBasicUsageExample is still used anywhere in the codebase

echo "Checking for usages of avatarBasicUsageExample..."
rg --type js --type jsx --type tsx "avatarBasicUsageExample" docs

Length of output: 202


🏁 Script executed:

#!/bin/bash
# Retry search without type filters to locate any references
echo "Searching for avatarBasicUsageExample across the docs directory..."
rg -n "avatarBasicUsageExample" docs

Length of output: 386


Action Required: Remove or Deprecate avatarBasicUsageExample Across Docs

avatarBasicUsageExample is still referenced in the MDX page and cannot be removed in isolation.

• docs/app/docs/components/avatar/docs/codeUsage.js:28
– Export of avatarBasicUsageExample
• docs/app/docs/components/avatar/page.mdx:3
import { avatarBasicUsageExample }
– Usage in the component’s props

Please either:

  • Remove avatarBasicUsageExample export and delete its import/usage in page.mdx, updating the page to rely solely on api_documentation;
  • Or mark avatarBasicUsageExample as @deprecated in codeUsage.js and add a deprecation notice in page.mdx for backward‐compatibility.
🧹 Nitpick comments (31)
docs/app/docs/components/blockquote/examples/BlockQuoteExample.tsx (1)

1-11: LGTM - Clean implementation of example component.

The component is well-structured and follows React functional component patterns. It clearly demonstrates the BlockQuote component with appropriate props and content.

Consider adding TypeScript prop type definitions for improved type safety, even though this is a simple example component:

+interface BlockQuoteExampleProps {}

-const BlockQuoteExample = () => (
+const BlockQuoteExample: React.FC<BlockQuoteExampleProps> = () => (
    <div className="text-gray-950">
        <BlockQuote color="green">
            "Behind every great man is a woman rolling her eyes." — Jim Carrey
        </BlockQuote>
    </div>
)
docs/app/docs/components/switch/docs/examples/SwitchExample.tsx (1)

5-8: Consider adding an accessible label.
The Switch example currently renders without an accessible label or ARIA attribute, which can make it difficult for screen reader users. You could enhance accessibility by adding an aria-label or a visually hidden label, for example:

<Switch.Root aria-label="Enable notifications">
  <Switch.Thumb />
</Switch.Root>
src/components/ui/Avatar/fragments/AvatarImage.tsx (1)

13-16: Merge user-provided className with the default.
Currently, any className passed in props will be overridden by the default clsx call. To preserve user-supplied classes, destructure className and merge it:

- const AvatarImage = ({ src = '', alt = '', ...props }: AvatarImageProps) => {
-   const { rootClass } = useContext(AvatarContext);
-   return <AvatarPrimitiveImage className={clsx(`${rootClass}-image`)} src={src} alt={alt} {...props} />;
+ const AvatarImage = ({ src = '', alt = '', className, ...props }: AvatarImageProps) => {
+   const { rootClass } = useContext(AvatarContext);
+   return (
+     <AvatarPrimitiveImage
+       className={clsx(`${rootClass}-image`, className)}
+       src={src}
+       alt={alt}
+       {...props}
+     />
+   );
docs/app/docs/components/avatar/page.mdx (2)

3-3: Remove unused import.
avatarBasicUsageExample is imported but no longer used in this file—please remove it to clean up the code.


25-27: Enhance documentation structure with a section heading.
To clearly delineate the API reference from the rest of the content, consider adding an explicit section heading (e.g., <h2>API Documentation</h2> or a <Documentation.SectionTitle> component) above these tables.

docs/app/docs/components/progress/docs/api/root.tsx (1)

45-49: Consider renaming "customRootClass" to "className".

For better consistency with React conventions and other components in your design system, consider renaming the customRootClass prop to className.

-                name: "customRootClass",
-                info_tooltips: "Custom root class name to override default styling."
+                name: "className",
+                info_tooltips: "Custom class name to override default styling."
docs/app/docs/components/progress/docs/examples/ProgressExample.tsx (2)

7-7: Consider using a CSS class instead of inline style.

For better maintainability and separation of concerns, consider using a CSS class instead of an inline style for setting the width.

-        <Card style={{width: "90%"}}>
+        <Card className="w-90">

15-15: Remove unnecessary empty line.

There's an empty line at the end of the file that could be removed to keep the code clean.

docs/app/docs/components/avatar-group/page.mdx (1)

5-5: Combine imports from codeUsage for clarity.

Importing from ./docs/codeUsage twice can be consolidated:

-import codeUsage, { anatomy } from "./docs/codeUsage";
-import { api_documentation } from "./docs/codeUsage";
+import codeUsage, { anatomy, api_documentation } from "./docs/codeUsage";
docs/app/docs/components/avatar-group/docs/api/avatar.tsx (1)

2-17: Consistent formatting for object literals.

Normalize spacing around colons (key: value vs key : value) to match other API modules.

docs/app/docs/components/callout/docs/api/text.tsx (1)

1-38: Well-structured API documentation for the Text component

The documentation schema effectively defines the component's props with appropriate types, descriptions, and default values. This modular approach to documentation will make it easier for developers to understand the specific role of the Text subcomponent within the Callout composite.

Consider adding a default value for the className prop if one exists, rather than using "--" placeholder.

        },
        type: 'string',
-        default: '--',
+        default: "''",
       }
docs/app/docs/components/switch/docs/api/thumb.tsx (1)

1-38: Clear and comprehensive API documentation for the Thumb component

The API documentation is well-structured with appropriate props, types, and descriptions. Good job including default values for each prop, which helps developers understand the component's behavior out of the box.

I noticed that line 40 exists but is blank. Consider removing this unnecessary line.

export default data; 
-
docs/app/docs/components/callout/docs/api/icon.tsx (1)

1-38: Well-structured API documentation

The API documentation for the Callout Icon component is well-organized with clear descriptions and properly formatted props. The structure follows the established pattern for component documentation.

However, consider adding default values for the className prop if one exists in the implementation, rather than using "--" placeholder. If there truly is no default, the current approach is fine.

docs/app/docs/components/avatar/docs/api/image.tsx (1)

1-38: Consistent API documentation structure

The Avatar Image API documentation follows the same structured approach as other components, with clear prop descriptions and types. This consistency in documentation is valuable for developers using the component library.

Consider clarifying whether the src and alt props are required, since they have no default values but are essential for proper image rendering and accessibility.

src/components/ui/Callout/fragments/CalloutRoot.tsx (1)

12-12: Redundant type annotation

The type definition string | '' is redundant since an empty string is already a string type. Consider simplifying to just string.

-    className?: string | '' ;
+    className?: string;
docs/app/docs/components/avatar-group/docs/api/root.tsx (1)

1-62: Add TypeScript type definitions for documentation structure.

Consider adding TypeScript interfaces or types for the documentation data structure. This would provide type safety and make the documentation more maintainable.

interface PropInfo {
  name: string;
  info_tooltips: string;
}

interface PropData {
  prop: PropInfo;
  type: string | React.ReactNode;
  default: string;
}

interface ComponentDocumentation {
  name: string;
  description: string;
  columns: Array<{name: string, id: string}>;
  data: PropData[];
}

const data: ComponentDocumentation = {
  // Your existing data
}
docs/app/docs/components/switch/docs/api/root.tsx (1)

1-38: Add TypeScript type definitions for the documentation structure.

For consistency with TypeScript best practices, consider adding type definitions for the documentation data structure:

interface PropInfo {
  name: string;
  info_tooltips: string;
}

interface PropData {
  prop: PropInfo;
  type: string;
  default: string | null;
}

interface ComponentDocumentation {
  name: string;
  description: string;
  columns: Array<{name: string, id: string}>;
  data: PropData[];
}

const data: ComponentDocumentation = {
  // Your existing data
}
docs/components/layout/Documentation/helpers/ComponentFeatures/ComponentFeatures.js (2)

23-23: Consider using design tokens instead of hardcoded colors.

The hardcoded color values could be replaced with design tokens or CSS variables for better maintainability:

-              <span className="text-green-950 w-[24px] h-[24px] bg-green-500 rounded-full flex items-center justify-center p-1">
+              <span className="text-success-foreground w-[24px] h-[24px] bg-success rounded-full flex items-center justify-center p-1">

This makes it easier to maintain consistent theming across the application.


22-29: Enhance list item accessibility.

The list item structure could benefit from additional accessibility attributes to better indicate the relationship between the icon and text:

-            <li className="flex items-center space-x-2" key={index}>
+            <li className="flex items-center space-x-2" key={index} aria-labelledby={`feature-${index}`}>
               <span className="text-green-950 w-[24px] h-[24px] bg-green-500 rounded-full flex items-center justify-center p-1">
                 <TickIcon />
               </span>
-              <span>
+              <span id={`feature-${index}`}>
               {feature}
               </span>
             </li>

This improves the association between the icon and the feature text for screen readers.

docs/app/docs/components/switch/page.mdx (2)

3-3: Clean up spacing and formatting.

There's inconsistent spacing in the imports and throughout the document with multiple empty lines that could be cleaned up:

 import Documentation from "@/components/layout/Documentation/Documentation"
 import Switch from "@radui/ui/Switch"
-import codeUsage, { api_documentation } from "./docs/codeUsage"
+import codeUsage, { api_documentation } from "./docs/codeUsage"
 import switchMetadata from "./seo"

-import SwitchExample from "./docs/examples/SwitchExample"
+import SwitchExample from "./docs/examples/SwitchExample"
 
 export const metadata = switchMetadata;
 
-
-
-
-
 <Documentation  title='Switch' description={`
             Switch is used to toggle between two states on and off. It is commonly used in settings panel, forms and any other 
             place where a user needs to enable or disable feature.
             `}>
             <Documentation.ComponentHero codeUsage={codeUsage}>
                 <SwitchExample />
             </Documentation.ComponentHero>
 
-                 {/* API Documentation */}
-    <Documentation.Table title="Root" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
-    <Documentation.Table title="Thumb" description={api_documentation.thumb.description} columns={api_documentation.thumb.columns} data={api_documentation.thumb.data} />
-
-
-
+    {/* API Documentation */}
+    <Documentation.Table 
+        title="Root" 
+        description={api_documentation.root.description} 
+        columns={api_documentation.root.columns} 
+        data={api_documentation.root.data} 
+    />
+    <Documentation.Table 
+        title="Thumb" 
+        description={api_documentation.thumb.description} 
+        columns={api_documentation.thumb.columns} 
+        data={api_documentation.thumb.data} 
+    />
 
         </Documentation>

Consistent spacing and indentation will improve code readability.

Also applies to: 6-7, 11-14, 23-26


24-25: Add type checking for API documentation data.

Consider adding runtime validation or TypeScript type guards to ensure the api_documentation structure matches what's expected by the Documentation.Table component. This would help catch errors if the structure changes:

// Example validation function
const validateApiDoc = (doc) => {
  if (!doc || !doc.description || !doc.columns || !doc.data) {
    console.error('Invalid API documentation structure', doc);
    return false;
  }
  return true;
};

// Usage in component
{validateApiDoc(api_documentation.root) && (
  <Documentation.Table 
      title="Root" 
      description={api_documentation.root.description} 
      columns={api_documentation.root.columns} 
      data={api_documentation.root.data} 
  />
)}
docs/app/docs/components/callout/examples/CalloutSizes.tsx (2)

7-7: Remove unused variants array

The variants array is defined but never used in the component rendering. Consider removing this unused variable to clean up the code.

-    const variants = ['soft', 'outline'];

8-10: Simplify nested flex containers

The current implementation has two nested flex containers with similar styling. Consider simplifying to a single flex container for better code maintainability.

-    return <div className='flex flex-col gap-4'>
-
-             <div  className='flex flex-col gap-4 justify-center flex-wrap'>
+    return <div className='flex flex-col gap-4 justify-center'>
docs/app/docs/components/avatar/docs/api/root.tsx (2)

25-26: Consider providing actual default values instead of "--"

Using "--" for default values that don't exist could be confusing. Consider using "None" or "undefined" for better clarity.

-        default : "--",
+        default : "None",

Also applies to: 33-34


57-58: Standardize empty string representation

The empty string defaults are represented as backticks (``) which is inconsistent with other default values. Consider standardizing to single quotes or explicitly stating "Empty String".

-        default: '``',
+        default: "''",

Also applies to: 65-66, 73-74

docs/app/docs/components/toggle-group/docs/api/root.tsx (3)

34-34: Consider using consistent formatting for default values.

The default value for className is wrapped in quotes (''), which is inconsistent with other string defaults like "null" (lines 60 and 68). Consider standardizing the formatting across all default values.

-            default: "''",
+            default: "\"\"",

52-53: Fix indentation inconsistency.

There's an indentation issue at the end of this object that creates inconsistent code formatting.

-           },
-        
+            },

70-71: Remove unnecessary empty line.

There's an extra blank line between object entries that breaks the consistent spacing pattern used elsewhere in the file.

-        },
-        
+        },
docs/app/docs/components/avatar-group/docs/api/item.tsx (1)

18-35: Ensure consistent spacing in object structure.

The indentation and spacing within the data array objects is inconsistent. Consider standardizing the formatting for better readability.

    data:[
       {
-        prop : {
-            name : "color",
-            info_tooltips : "The color of the AvatarGroupItem."
-        },
-        type : "string",
-        default : "--",
+           prop: {
+               name: "color",
+               info_tooltips: "The color of the AvatarGroupItem."
+           },
+           type: "string",
+           default: "--",
       },
       {
-        prop : {
-            name : "children",
-            info_tooltips : "The children of the AvatarGroupItem."
-        },
-        type : "React.ReactNode",
-        default : "--",
+           prop: {
+               name: "children",
+               info_tooltips: "The children of the AvatarGroupItem."
+           },
+           type: "React.ReactNode",
+           default: "--",
       }
    ]
docs/app/docs/components/avatar-group/docs/api/fallback.tsx (1)

18-27: Ensure consistent spacing in object structure.

The indentation and spacing within the data array objects is inconsistent compared to other API documentation files. Consider standardizing the formatting for better readability.

    data:[
       {
-        prop : {
-            name : "children",
-            info_tooltips : "The children of the AvatarFallback."
-        },
-        type : "React.ReactNode",
-        default : "--",
+           prop: {
+               name: "children",
+               info_tooltips: "The children of the AvatarFallback."
+           },
+           type: "React.ReactNode",
+           default: "--",
       }
    ]
docs/app/docs/components/callout/examples/CalloutVariants.tsx (1)

19-21: Remove console.log statement

The console.log statement appears to be a debugging artifact and should be removed before production.

- {calloutVariants.map((variant,idx) => {
-   console.log(variant);
-   return <span key={idx}>
+ {calloutVariants.map((variant,idx) => (
+   <span key={idx}>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f080c82 and 754c267.

⛔ Files ignored due to path filters (1)
  • docs/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (52)
  • docs/app/docs/components/avatar-group/docs/api/avatar.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/api/fallback.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/api/item.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/avatarGroup_anatomy.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/avatar-group/docs/example_1.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/page.mdx (2 hunks)
  • docs/app/docs/components/avatar/docs/AvatarExample.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/api/fallback.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/api/image.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/avatar/page.mdx (2 hunks)
  • docs/app/docs/components/blockquote/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/blockquote/examples/BlockQuoteExample.tsx (1 hunks)
  • docs/app/docs/components/blockquote/page.mdx (2 hunks)
  • docs/app/docs/components/callout/docs/api/callout.tsx (0 hunks)
  • docs/app/docs/components/callout/docs/api/icon.tsx (1 hunks)
  • docs/app/docs/components/callout/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/callout/docs/api/text.tsx (1 hunks)
  • docs/app/docs/components/callout/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/callout/examples/CalloutColor.tsx (1 hunks)
  • docs/app/docs/components/callout/examples/CalloutExample.tsx (1 hunks)
  • docs/app/docs/components/callout/examples/CalloutSizes.tsx (1 hunks)
  • docs/app/docs/components/callout/examples/CalloutVariants.tsx (2 hunks)
  • docs/app/docs/components/callout/page.mdx (3 hunks)
  • docs/app/docs/components/progress/docs/api/indicator.tsx (1 hunks)
  • docs/app/docs/components/progress/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/progress/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/progress/docs/examples/ProgressExample.tsx (1 hunks)
  • docs/app/docs/components/progress/page.mdx (2 hunks)
  • docs/app/docs/components/switch/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/switch/docs/api/thumb.tsx (1 hunks)
  • docs/app/docs/components/switch/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/switch/docs/examples/SwitchExample.tsx (1 hunks)
  • docs/app/docs/components/switch/page.mdx (2 hunks)
  • docs/app/docs/components/toggle-group/docs/api/item.tsx (1 hunks)
  • docs/app/docs/components/toggle-group/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/toggle-group/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/toggle-group/docs/examples/ToggleGroupExample.tsx (1 hunks)
  • docs/app/docs/components/toggle-group/page.mdx (2 hunks)
  • docs/components/layout/Documentation/helpers/ComponentFeatures/ComponentFeatures.js (1 hunks)
  • docs/components/layout/Documentation/helpers/DocsTable.js (1 hunks)
  • docs/package.json (1 hunks)
  • src/components/ui/Avatar/fragments/AvatarFallback.tsx (1 hunks)
  • src/components/ui/Avatar/fragments/AvatarImage.tsx (1 hunks)
  • src/components/ui/AvatarGroup/fragments/AvatarGroupRoot.tsx (1 hunks)
  • src/components/ui/Callout/Callout.tsx (0 hunks)
  • src/components/ui/Callout/fragments/CalloutRoot.tsx (1 hunks)
  • src/components/ui/Progress/stories/Progress.stories.tsx (0 hunks)
  • styles/themes/components/switch.scss (1 hunks)
💤 Files with no reviewable changes (3)
  • src/components/ui/Progress/stories/Progress.stories.tsx
  • src/components/ui/Callout/Callout.tsx
  • docs/app/docs/components/callout/docs/api/callout.tsx
🧰 Additional context used
🧬 Code Graph Analysis (7)
docs/app/docs/components/avatar-group/docs/example_1.tsx (1)
docs/app/docs/components/avatar-group/docs/avatarGroup_anatomy.tsx (1)
  • AvatarGroup (3-12)
docs/components/layout/Documentation/helpers/ComponentFeatures/ComponentFeatures.js (1)
docs/components/layout/Documentation/utils.js (2)
  • BookMarkLink (7-40)
  • BookMarkLink (7-40)
src/components/ui/Avatar/fragments/AvatarFallback.tsx (2)
src/core/primitives/Avatar/fragments/AvatarPrimitiveFallback.tsx (1)
  • AvatarPrimitiveFallbackProps (5-9)
src/components/ui/Avatar/contexts/AvatarContext.tsx (1)
  • AvatarContext (9-14)
docs/app/docs/components/callout/examples/CalloutSizes.tsx (1)
docs/app/docs/components/callout/examples/CalloutExample.tsx (1)
  • BookmarkIcon (5-7)
docs/app/docs/components/avatar-group/docs/codeUsage.js (4)
docs/app/docs/components/callout/docs/codeUsage.js (2)
  • api_documentation (23-27)
  • api_documentation (23-27)
docs/app/docs/components/blockquote/docs/codeUsage.js (2)
  • api_documentation (18-20)
  • api_documentation (18-20)
docs/app/docs/components/avatar/docs/codeUsage.js (2)
  • api_documentation (22-26)
  • api_documentation (22-26)
docs/app/docs/components/accordion/docs/codeUsage.js (2)
  • api_documentation (29-33)
  • api_documentation (29-33)
docs/app/docs/components/callout/examples/CalloutVariants.tsx (1)
docs/app/docs/components/callout/examples/CalloutExample.tsx (1)
  • BookmarkIcon (5-7)
docs/app/docs/components/callout/examples/CalloutColor.tsx (1)
docs/app/docs/components/callout/examples/CalloutExample.tsx (1)
  • BookmarkIcon (5-7)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: lint
🔇 Additional comments (61)
docs/app/docs/components/blockquote/page.mdx (2)

10-10: LGTM - Good modularization of example component.

The import of the BlockQuoteExample component follows best practices for code organization by extracting example components into dedicated files.


20-20: LGTM - Clean implementation of component reuse.

Moving from an inline BlockQuote implementation to a reusable example component improves maintainability and consistency across the documentation.

docs/app/docs/components/blockquote/docs/codeUsage.js (4)

1-1: LGTM - Good utility import.

Using the utility function for parsing source code enables a consistent approach across all component documentation.


3-6: LGTM - Good approach to dynamically loading example code.

Dynamically loading source code from actual example files ensures that the documentation always shows the current implementation, maintaining a single source of truth.


10-11: LGTM - Using dynamically loaded source code.

Replacing hardcoded code examples with dynamically loaded files improves maintainability and ensures the documentation stays in sync with the actual implementation.

Also applies to: 13-14


1-6:

❓ Verification inconclusive

Verify that top-level await is supported in your environment.

This file uses top-level await for asynchronously loading source code files. While this works in Node.js ESM modules and is supported by Next.js, it's worth ensuring compatibility with your current build setup.


🏁 Script executed:

#!/bin/bash
# Check if package.json has type: "module" or if Next.js config supports top-level await
grep -E '"type":\s*"module"|moduleType' package.json
grep -E 'webpack|experimental' next.config.js

Length of output: 170


🏁 Script executed:

#!/bin/bash
# Verify ESM, frameworks, and bundlers to ensure top-level await support
grep -n '"type":\s*"module"' package.json || echo "→ no ESM declaration"
grep -n '"next"' package.json || echo "→ no Next.js dependency"
grep -n '"@docusaurus"' package.json || echo "→ no Docusaurus dependency"
grep -n '"webpack"' package.json || echo "→ no webpack dependency"
grep -n '"vite"' package.json || echo "→ no vite dependency"
find . -maxdepth 2 -type f -name 'next.config.*' -print || echo "→ no Next.js config file"

Length of output: 511


🏁 Script executed:

#!/bin/bash
# Inspect docs site configuration for ESM and Next.js settings

echo "🔍 Finding package.json in docs/ directory:"
find docs -maxdepth 2 -type f -name 'package.json' -print

echo -e "\n📄 docs/package.json (first 50 lines):"
sed -n '1,50p' docs/package.json

echo -e "\n🔍 Checking ESM declaration and dependencies in docs/package.json:"
grep -n '"type":' docs/package.json || echo "→ no type field"
grep -n '"next"' docs/package.json || echo "→ no Next.js dependency"
grep -n '"webpack"' docs/package.json || echo "→ no webpack dependency"
grep -n '"vite"' docs/package.json || echo "→ no vite dependency"

echo -e "\n📄 docs/next.config.js (first 200 lines):"
sed -n '1,200p' docs/next.config.js || echo "→ docs/next.config.js not found"

Length of output: 2538


Verify top-level await compatibility in your docs site build

File: docs/app/docs/components/blockquote/docs/codeUsage.js (lines 1–6)

This module relies on a top-level await to load example source files:

import { getSourceCodeFromPath } from '@/utils/parseSourceCode';
const example_1_SourceCode = await getSourceCodeFromPath(`docs/app/docs/components/blockquote/examples/BlockQuoteExample.tsx`);
const scss_SourceCode        = await getSourceCodeFromPath('styles/themes/components/blockquote.scss');

Our documentation site is powered by Next.js v15.2.3 with @next/mdx. Its docs/package.json has no "type": "module" and docs/next.config.js is CommonJS, so while SWC typically handles top-level await in server components, please:

  • Run npm run build (or next build) to ensure there are no syntax errors.
  • If the build fails, consider wrapping these calls in an async IIFE or converting this module into an async server component.
styles/themes/components/switch.scss (1)

25-27: The addition of a blank line here is purely stylistic and does not affect functionality. The separation improves readability.

docs/app/docs/components/progress/docs/api/root.tsx (2)

2-3: LGTM! Clear and accurate component renaming.

Renaming from "Progress" to "Root" with the updated description properly clarifies this as the root component for Progress, aligning with the composable API pattern being implemented across components.


18-50: LGTM! Props are well-defined with clear descriptions.

The props table provides clear type information, default values, and helpful tooltips for each prop. The removal of "color" and "renderLabel" props (as noted in the AI summary) aligns with the API restructuring.

docs/app/docs/components/avatar/docs/AvatarExample.tsx (1)

5-8: LGTM! Well-implemented composition pattern.

The refactoring to use Avatar.Root, Avatar.Image, and Avatar.Fallback components creates a more explicit and flexible composition pattern, aligning with modern React component design best practices.

docs/app/docs/components/progress/docs/examples/ProgressExample.tsx (1)

5-13: LGTM! Clear example demonstrating the new composition pattern.

The example effectively demonstrates the new Progress component structure with Root and Indicator subcomponents.

docs/components/layout/Documentation/helpers/DocsTable.js (1)

58-59: LGTM! Good defensive programming practice.

Adding a default empty array for the enumValues prop prevents potential runtime errors when this prop is undefined or null. This enhances the robustness of the code, especially important for documentation components that need to handle various data structures.

docs/app/docs/components/avatar-group/page.mdx (1)

20-23: API tables integration is correct.

The four <Documentation.Table> entries correctly render the modular API docs for Root, Item, Avatar, and Fallback using the api_documentation object.

docs/app/docs/components/toggle-group/docs/api/item.tsx (1)

1-38: New API metadata is accurate.

The data object correctly defines the ToggleGroup Item props, column schema, and default values. It follows the established pattern and has no issues.

docs/app/docs/components/progress/docs/api/indicator.tsx (1)

1-28: Indicator API metadata is well-defined.

The new documentation object for the Indicator component accurately specifies its prop schema, defaults, and description. No issues found.

docs/app/docs/components/progress/page.mdx (3)

6-7: Good addition of a separate example component

Moving to using a dedicated example component (ProgressExample) makes the code more maintainable and follows the component composition pattern used throughout the documentation.


16-17: LGTM - Clean usage of imported example component

Using the imported ProgressExample component keeps the documentation page cleaner and more maintainable compared to having inline examples.


24-27: Well-structured API documentation with component composition

Breaking the API documentation into separate tables for Root and Indicator components follows good component composition principles. This makes the documentation more granular and easier to understand, especially for developers new to the component.

docs/app/docs/components/callout/page.mdx (3)

5-6: Good modularization with separate example component

Adding the separate CalloutExample component follows the pattern of modularizing examples across the documentation system.


23-24: Clean usage of example component

Using the imported CalloutExample component instead of an inline implementation keeps the documentation page cleaner.


47-52: Well-structured API documentation using composable pattern

The API documentation is now properly broken down into Root, Icon, and Text components, making it clearer for developers to understand the component structure. This composition-based approach aligns well with the composable API pattern being implemented across the documentation.

docs/app/docs/components/toggle-group/page.mdx (3)

3-4: Good modularization of imports and structure

The updated imports shift toward a more modular approach by:

  1. Simplifying the base import
  2. Adding the structured api_documentation object
  3. Including the more comprehensive ToggleGroupExample component

This approach is consistent with the improved documentation pattern across the codebase.

Also applies to: 7-9


19-20: Updated to use the new example component

Switching from ToggleGroupExampleBasic to ToggleGroupExample aligns this documentation with the updated component examples pattern.


22-25: Well-structured API documentation with component composition

Breaking down the API documentation into Root and Item tables provides a clearer structure that follows the composable API pattern, making it more intuitive for developers to understand the component's usage.

src/components/ui/Avatar/fragments/AvatarFallback.tsx (3)

9-11: Good type extension for better prop customization

Creating a new type that extends AvatarPrimitiveFallbackProps with an optional className prop follows good TypeScript practices and enables proper component customization.


13-13: Added default value for className - good practice

Adding a default empty string for className is a good defensive programming practice, ensuring the component behaves predictably even when the prop is not provided.


15-15: Proper class merging with clsx

Using clsx to merge the component's base class with the custom className ensures styles are properly combined without conflicts. This allows for external styling customization while maintaining the component's core styling.

docs/app/docs/components/avatar-group/docs/avatarGroup_anatomy.tsx (1)

6-9: The updated composable component structure looks clean and intuitive.

The hierarchy has been improved with more semantically named components replacing the previous nested structure. The new pattern with Item, Avatar, and Fallback is more intuitive and consistent with modern component composition patterns.

docs/app/docs/components/avatar-group/docs/example_1.tsx (2)

1-1: Good addition of the "use client" directive

This correctly marks the component as a client component for Next.js, ensuring it will be properly handled during rendering.


5-18: Well-implemented composable pattern with clear API usage

The example effectively demonstrates the new component structure with multiple avatar items. Each item is properly configured with color, avatar image source, and fallback content, showcasing the flexibility of the new API.

docs/app/docs/components/callout/examples/CalloutExample.tsx (1)

1-20: Good implementation of the composable Callout component pattern

The example clearly demonstrates the usage of the Callout component with its composable parts (Root, Icon, and Text). The code is well-structured and includes the necessary "use client" directive.

docs/app/docs/components/avatar/docs/api/fallback.tsx (2)

22-23: Correct tooltip label

The tooltip correctly identifies this as AvatarFallback, which confirms that the component name should be "Fallback" rather than "Image".


29-31: Correct tooltip label

The tooltip correctly identifies this as AvatarFallback, matching the expected purpose of this file.

src/components/ui/AvatarGroup/fragments/AvatarGroupRoot.tsx (1)

16-16: Good practice: Default value for className prop

Adding a default empty string for the className prop is a good practice. This ensures that className is always a string when passed to the clsx function, preventing potential issues with undefined values.

docs/app/docs/components/toggle-group/docs/examples/ToggleGroupExample.tsx (3)

1-20: Well-structured SVG icon components

The SVG icon components are well-defined with proper viewBox and paths, making them suitable for use in the toggle group items.


35-41: Good implementation of composable ToggleGroup pattern

The example effectively demonstrates the composable pattern using ToggleGroup.Root and ToggleGroup.Item components with proper key and value props.


21-27: Well-structured items array

The items array is well-structured, pairing SVG icons with values, which allows for a clean mapping to ToggleGroup.Item components.

docs/app/docs/components/switch/docs/codeUsage.js (2)

1-15: Good refactoring to use dynamic source code loading

The refactoring to load example code and styles from external files improves maintainability and organization. Creating a structured API documentation object with separate modules for different component parts (root and thumb) follows good modular design principles.


20-24: Appropriate update of code references

The code object has been correctly updated to reference the dynamically loaded source code instead of hardcoded strings, which is consistent with the refactoring approach.

src/components/ui/Callout/fragments/CalloutRoot.tsx (1)

21-21: Good practice: Added default values for string props

Adding explicit default values for className and customRootClass props is a good practice that prevents potential issues with undefined values during class name concatenation. This makes the component more robust and predictable.

docs/app/docs/components/callout/docs/codeUsage.js (2)

8-10: Great use of dynamic source code loading

The use of getSourceCodeFromPath to asynchronously load example source code and styles is a good practice for maintainability and code organization.


23-27: Well-structured API documentation exports

Breaking down the API documentation into separate components (root, icon, text) aligns well with the compound component pattern and improves documentation clarity.

docs/app/docs/components/callout/docs/api/root.tsx (1)

22-23: Consistent component references in tooltips

The tooltip correctly references "CalloutRoot" which is good, but make sure this consistency is maintained throughout the file.

docs/app/docs/components/toggle-group/docs/api/root.tsx (1)

1-82: LGTM! Well-structured API documentation for the ToggleGroup Root component.

The file establishes a clean and consistent format for documenting component API props, with appropriate columns for props, types, and default values. This structured approach will enhance the documentation's maintainability and readability.

docs/app/docs/components/avatar-group/docs/api/item.tsx (1)

1-38: LGTM! Well-structured API documentation for the AvatarGroup Image component.

The documentation structure looks good with clear props, types, and default values.

docs/app/docs/components/avatar-group/docs/api/fallback.tsx (1)

1-30: LGTM! Well-structured API documentation for the Avatar Fallback component.

The documentation structure is clear with appropriate props, types, and default values.

docs/app/docs/components/avatar/docs/codeUsage.js (3)

1-5: LGTM! Good refactoring to use dynamically loaded source code.

Replacing hardcoded examples with dynamically loaded code via getSourceCodeFromPath improves maintainability and keeps the documentation in sync with actual component examples.


8-10: LGTM! Good modularization of API documentation.

Importing separate API documentation modules for each subcomponent creates a cleaner structure and better separation of concerns.


22-26: LGTM! Well-organized API documentation export structure.

The api_documentation export provides a clean way to access the documentation for each subcomponent.

docs/app/docs/components/toggle-group/docs/codeUsage.js (3)

1-5: Good refactoring to dynamic source code loading

This change improves maintainability by using the getSourceCodeFromPath utility to load example code and styles from external files instead of defining them inline.


8-15: Great modularization of API documentation

Breaking down the API documentation into separate modules for root and item components aligns with a composable pattern, making the documentation more maintainable and easier to update when component changes occur.


17-24: Clean code structure for examples

The code structure is clean and straightforward, utilizing the external source files effectively. This organization will make future updates simpler.

docs/app/docs/components/callout/examples/CalloutVariants.tsx (3)

1-1: Good addition of client directive

Adding "use client" is appropriate since this component will render on the client side.


6-6: Improved import organization

Updating the import path to use the local BookmarkIcon from CalloutExample provides better component organization.


22-29: Good implementation of composable pattern

The refactoring to use Callout.Root, Callout.Icon, and Callout.Text follows the composable component pattern, making the component structure more explicit and easier to understand.

docs/app/docs/components/progress/docs/codeUsage.js (3)

2-9: Excellent separation of API documentation and dynamic loading

This change properly separates the Progress component API into root and indicator parts while also implementing dynamic loading of example code and styles from external files. This approach improves maintainability and consistency.


13-18: Clean implementation of code examples

Using dynamically loaded source code for both JavaScript examples and CSS simplifies maintenance and keeps the documentation file clean.


24-25: Appropriate API documentation structure

The separation of API documentation into root and indicator components reflects the composable nature of the Progress component, making it easier for developers to understand the component's structure.

docs/app/docs/components/callout/examples/CalloutColor.tsx (3)

1-3: Good client directive and import updates

Adding the "use client" directive and updating imports to match the new component structure is appropriate.


6-9: Improved demonstration of color variants

Simplifying the component to focus only on demonstrating color variations makes this example more focused and easier to understand.


10-17: Well-structured composable component usage

Using the composable pattern with Callout.Root, Callout.Icon, and Callout.Text provides a clear structure and demonstrates the proper usage of the component. This is consistent with the changes in CalloutVariants.tsx.

"@next/mdx": "^15.2.0",
"@radui/fx": "^0.2.0",
"@radui/ui": "^0.0.38",
"@radui/ui": "^0.0.39",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Commit lockfile update for dependency bump.
When bumping @radui/ui to a new version, ensure that the lockfile (package-lock.json, yarn.lock, or pnpm-lock.yaml) is regenerated and committed to avoid drift between package.json and installed dependencies.

Comment on lines 9 to 12
import root_api_SourceCode from './api/root.tsx';
import item_api_SourceCode from './api/item.tsx';
import avatar_api_SourceCode from './api/avatar.tsx';
import fallback_api_SourceCode from './api/fallback.tsx';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: imports must precede all code.

ESM requires all import statements at the top level before any executable code. These API imports are currently placed after await calls, which will throw a syntax error. Please move them above the first await:

-const example_1_SourceCode = await getSourceCodeFromPath(...);
-import root_api_SourceCode from './api/root.tsx';
-import item_api_SourceCode from './api/item.tsx';
-import avatar_api_SourceCode from './api/avatar.tsx';
-import fallback_api_SourceCode from './api/fallback.tsx';
+import root_api_SourceCode from './api/root.tsx';
+import item_api_SourceCode from './api/item.tsx';
+import avatar_api_SourceCode from './api/avatar.tsx';
+import fallback_api_SourceCode from './api/fallback.tsx';
+const example_1_SourceCode = await getSourceCodeFromPath(...);

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Contributor

@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: 0

♻️ Duplicate comments (1)
docs/app/docs/components/avatar-group/docs/api/item.tsx (1)

1-38: Inconsistent spacing in object property definitions.

There's inconsistent spacing around colons in the object properties throughout the file. Standardizing this would improve code consistency.

-    name : "Item",
+    name: "Item",
-    description : "The item component for the AvatarGroup.",
+    description: "The item component for the AvatarGroup.",
-    columns : [
+    columns: [
// ... (apply similar changes throughout the file)
🧹 Nitpick comments (5)
docs/app/docs/components/avatar-group/docs/api/avatar.tsx (3)

1-38: Inconsistent spacing in object property definitions.

There's inconsistent spacing around colons in the object properties. Some have spaces before and after the colon (e.g., name : "Avatar"), while others have space only after (e.g., name: "Default"). Standardizing this would improve code consistency.

-    name : "Avatar",
+    name: "Avatar",
-    description : "The avatar component for the AvatarGroup.",
+    description: "The avatar component for the AvatarGroup.",
-    columns : [
+    columns: [
-            name : "Prop",
+            name: "Prop",
-            id : "prop",
+            id: "prop",
// ... (apply similar changes throughout the file)

18-35: Consider adding TypeScript interfaces for the data structure.

The file could benefit from TypeScript interfaces to define the structure of the API documentation data. This would provide better type safety, autocompletion in IDEs, and make the code more maintainable.

interface PropDefinition {
  name: string;
  info_tooltips: string;
}

interface PropData {
  prop: PropDefinition;
  type: string;
  default: string;
}

interface ColumnDefinition {
  name: string;
  id: string;
}

interface ComponentApiData {
  name: string;
  description: string;
  columns: ColumnDefinition[];
  data: PropData[];
}

const data: ComponentApiData = {
  // ... existing data
};

22-22: Consider renaming info_tooltips to singular form.

The property info_tooltips is plural but contains a single string value. Consider renaming it to info_tooltip for better semantic accuracy, or ensure it's designed to accept an array of tooltips if pluralization is intentional.

-            info_tooltips : "The source of the avatar."
+            info_tooltip: "The source of the avatar."

Also applies to: 30-30

docs/app/docs/components/avatar-group/docs/api/item.tsx (2)

32-32: Consider adding more specific type information for "children".

The type for the "children" prop is specified as a string "React.ReactNode". When building the actual component, make sure to properly type this using TypeScript's type system rather than treating it as a string.

If implementing TypeScript interfaces as suggested in the previous file, this would become:

interface PropData {
  prop: PropDefinition;
  type: string; // For documentation display purposes
  default: string;
}

// When actually implementing the component:
interface ItemProps {
  color?: string;
  children?: React.ReactNode;
}

1-38: Consider adding consistent default values information.

Both props have default values listed as "--" which implies they don't have default values. If the color prop has a default value in the actual implementation, it would be helpful to document it here. Similarly, clarify if children can be null/undefined.

For example, if color has a default value:

-        default : "--",
+        default : "gray", // or whatever the actual default is
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 754c267 and 8e56631.

📒 Files selected for processing (6)
  • docs/app/docs/components/avatar-group/docs/api/avatar.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/api/fallback.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/api/item.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/api/root.tsx (1 hunks)
  • docs/app/docs/components/callout/docs/api/root.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/app/docs/components/avatar-group/docs/api/root.tsx
  • docs/app/docs/components/avatar/docs/api/root.tsx
  • docs/app/docs/components/avatar-group/docs/api/fallback.tsx
  • docs/app/docs/components/callout/docs/api/root.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

Copy link
Contributor

@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: 0

🧹 Nitpick comments (3)
docs/app/docs/components/avatar/docs/codeUsage.js (1)

28-40: Consider removing or updating the legacy example object

The avatarBasicUsageExample object seems redundant now that you've introduced the more structured api_documentation export. This object appears to contain outdated documentation that doesn't reflect the new composable API structure with separate Root, Image, and Fallback components.

Consider either:

  1. Removing this object if it's no longer used
  2. Updating it to align with the new component structure
  3. Adding a comment explaining why it's being retained if needed for backward compatibility
docs/app/docs/components/callout/docs/codeUsage.js (1)

4-4: Import style inconsistency.

There's an inconsistency in import styles - icon_api_SourceCode uses named import syntax with curly braces while the other imports use default import syntax. Consider standardizing the import approach for better consistency.

-import {icon_api_SourceCode} from './component_api/icon.tsx';
+import icon_api_SourceCode from './component_api/icon.tsx';
docs/app/docs/components/toggle-group/docs/codeUsage.js (1)

1-27: Consider standardizing variable naming conventions.

The variable names use slightly inconsistent patterns: example_1_SourceCode, scss_SourceCode, and root_api_SourceCode. Consider standardizing the naming pattern across all variables for better readability.

-const example_1_SourceCode = await getSourceCodeFromPath('docs/app/docs/components/toggle-group/docs/examples/ToggleGroupExample.tsx');
-const scss_SourceCode = await getSourceCodeFromPath('styles/themes/components/toggle-group.scss');
-import root_api_SourceCode from "./component_api/root.tsx";
-import item_api_SourceCode from "./component_api/item.tsx";
+const exampleSourceCode = await getSourceCodeFromPath('docs/app/docs/components/toggle-group/docs/examples/ToggleGroupExample.tsx');
+const scssSourceCode = await getSourceCodeFromPath('styles/themes/components/toggle-group.scss');
+import rootApiSourceCode from "./component_api/root.tsx";
+import itemApiSourceCode from "./component_api/item.tsx";

 export const api_documentation = {
-    root: root_api_SourceCode,
-    item: item_api_SourceCode
+    root: rootApiSourceCode,
+    item: itemApiSourceCode
 };

 const code = {
     javascript: {
-        code: example_1_SourceCode,
+        code: exampleSourceCode,
     },
     css: {
-        code: scss_SourceCode
+        code: scssSourceCode
     }
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e56631 and a491875.

📒 Files selected for processing (34)
  • docs/app/docs/components/accordion/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/avatar-group/docs/codeUsage.js (2 hunks)
  • docs/app/docs/components/avatar-group/docs/component_api/avatar.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/component_api/fallback.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/component_api/item.tsx (1 hunks)
  • docs/app/docs/components/avatar-group/docs/component_api/root.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/avatar/docs/component_api/fallback.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/component_api/image.tsx (1 hunks)
  • docs/app/docs/components/avatar/docs/component_api/root.tsx (1 hunks)
  • docs/app/docs/components/blockquote/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/button/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/callout/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/callout/docs/component_api/icon.tsx (1 hunks)
  • docs/app/docs/components/callout/docs/component_api/root.tsx (1 hunks)
  • docs/app/docs/components/callout/docs/component_api/text.tsx (1 hunks)
  • docs/app/docs/components/card/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/code/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/em/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/heading/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/kbd/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/progress/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/progress/docs/component_api/indicator.tsx (1 hunks)
  • docs/app/docs/components/progress/docs/component_api/root.tsx (1 hunks)
  • docs/app/docs/components/separator/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/strong/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/switch/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/switch/docs/component_api/root.tsx (1 hunks)
  • docs/app/docs/components/switch/docs/component_api/thumb.tsx (1 hunks)
  • docs/app/docs/components/text/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/toggle-group/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/toggle-group/docs/component_api/item.tsx (1 hunks)
  • docs/app/docs/components/toggle-group/docs/component_api/root.tsx (1 hunks)
  • docs/app/docs/components/tooltip/docs/codeUsage.js (1 hunks)
✅ Files skipped from review due to trivial changes (27)
  • docs/app/docs/components/strong/docs/codeUsage.js
  • docs/app/docs/components/button/docs/codeUsage.js
  • docs/app/docs/components/separator/docs/codeUsage.js
  • docs/app/docs/components/code/docs/codeUsage.js
  • docs/app/docs/components/kbd/docs/codeUsage.js
  • docs/app/docs/components/heading/docs/codeUsage.js
  • docs/app/docs/components/card/docs/codeUsage.js
  • docs/app/docs/components/em/docs/codeUsage.js
  • docs/app/docs/components/text/docs/codeUsage.js
  • docs/app/docs/components/tooltip/docs/codeUsage.js
  • docs/app/docs/components/progress/docs/component_api/root.tsx
  • docs/app/docs/components/avatar/docs/component_api/image.tsx
  • docs/app/docs/components/accordion/docs/codeUsage.js
  • docs/app/docs/components/avatar/docs/component_api/fallback.tsx
  • docs/app/docs/components/switch/docs/component_api/thumb.tsx
  • docs/app/docs/components/avatar-group/docs/component_api/fallback.tsx
  • docs/app/docs/components/progress/docs/component_api/indicator.tsx
  • docs/app/docs/components/avatar-group/docs/component_api/item.tsx
  • docs/app/docs/components/toggle-group/docs/component_api/item.tsx
  • docs/app/docs/components/switch/docs/component_api/root.tsx
  • docs/app/docs/components/avatar-group/docs/component_api/avatar.tsx
  • docs/app/docs/components/toggle-group/docs/component_api/root.tsx
  • docs/app/docs/components/callout/docs/component_api/text.tsx
  • docs/app/docs/components/avatar/docs/component_api/root.tsx
  • docs/app/docs/components/avatar-group/docs/component_api/root.tsx
  • docs/app/docs/components/callout/docs/component_api/icon.tsx
  • docs/app/docs/components/callout/docs/component_api/root.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/app/docs/components/avatar-group/docs/codeUsage.js
  • docs/app/docs/components/blockquote/docs/codeUsage.js
  • docs/app/docs/components/progress/docs/codeUsage.js
  • docs/app/docs/components/switch/docs/codeUsage.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (13)
docs/app/docs/components/avatar/docs/codeUsage.js (4)

1-5: Good improvement using external source files!

Moving from hardcoded code strings to dynamically loaded source code using getSourceCodeFromPath is a great practice that improves maintainability and separation of concerns. This approach makes the example code and styles more maintainable as they can be edited in their own files with proper syntax highlighting and validation.


8-10: Well-structured API documentation imports

Breaking down the API documentation into separate files for each subcomponent (Root, Image, Fallback) follows good modular design principles. This supports the composable API pattern and makes the documentation more focused and maintainable.


14-15: Consistent usage of external source files

The code and SCSS references now use the dynamically loaded source code, which is consistent with the changes made in lines 1-5.

Also applies to: 17-18


22-26: Good addition of structured API documentation export

The new api_documentation export provides a well-organized way to access documentation for each Avatar subcomponent. This structure supports the composable API pattern and will help generate clear, component-specific documentation tables.

docs/app/docs/components/callout/docs/codeUsage.js (4)

1-1: Improved modular API documentation structure.

The imports have been restructured to support a composable API pattern with separate documentation for root, icon, and text components. This aligns with the broader pattern of modularization across UI components mentioned in the PR summary.

Also applies to: 3-5


8-10: Good refactoring to external source files.

The change from hardcoded example strings to dynamically loaded external source code is a good practice that improves maintainability and separation of concerns.

Note that the use of top-level await requires Node.js 14.8+ or an environment that supports ES modules with top-level await.


13-13: Successfully updated references to dynamically loaded code.

The code object now properly references the dynamically loaded source code instead of hardcoded strings, which aligns with the external source loading approach.

Also applies to: 16-16


24-26: Comprehensive API documentation with composable pattern.

The API documentation now follows a composable pattern with separate entries for root, icon, and text components, which makes the documentation more organized and easier to navigate.

docs/app/docs/components/toggle-group/docs/codeUsage.js (5)

1-3: Well-structured approach to loading example code.

Importing source code from external files rather than defining it inline creates better separation of concerns and makes both the documentation and examples easier to maintain.


5-6: Good separation of styling from documentation code.

Importing SCSS code externally keeps the documentation file clean and focused on structure rather than implementation details.


8-9: Excellent modular API documentation approach.

Importing API details from dedicated files per component part (root and item) aligns with the composable API structure and improves maintainability.


12-15: Clear organization of composable component API.

The exported object structure explicitly documents the composable nature of the ToggleGroup component, making it clear to users that it consists of root and item subcomponents.


17-24: Consistent code example structure.

The code object follows a clean pattern for organizing example source code, making it easy for documentation rendering components to access this content.

Copy link
Contributor

@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

🧹 Nitpick comments (2)
docs/app/docs/components/callout/page.mdx (2)

6-6: Remove Unused BookmarkIcon Import
After migrating the example into CalloutExample, BookmarkIcon is no longer referenced in this file. Consider removing it to avoid unused imports.


1-1: Remove or Use PageDetails Import
PageDetails is imported but never used. Either remove this import or render <PageDetails {...metadata} /> if it’s intended to inject SEO metadata.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a491875 and e089785.

📒 Files selected for processing (3)
  • docs/app/docs/components/callout/docs/codeUsage.js (1 hunks)
  • docs/app/docs/components/callout/docs/component_api/callout_icon.tsx (1 hunks)
  • docs/app/docs/components/callout/page.mdx (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/app/docs/components/callout/docs/component_api/callout_icon.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/app/docs/components/callout/docs/codeUsage.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (2)
docs/app/docs/components/callout/page.mdx (2)

5-5: Import New Composable Example Component
The import of CalloutExample aligns with the composable API pattern and matches existing example imports.


23-23: Use Composable CalloutExample
Replacing the inline Callout with <CalloutExample /> properly delegates the example rendering to the external component.

Comment on lines +47 to +50
{/* API Documentation */}
<Documentation.Table title="Root" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
<Documentation.Table title="Icon" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
<Documentation.Table title="Text" description={api_documentation.text.description} columns={api_documentation.text.columns} data={api_documentation.text.data} /> */}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix Comment Wrapping and API Table Data
The current comment syntax is invalid (you open a comment on line 47 but only close it on the last table line), and the Icon table is wired to api_documentation.root instead of api_documentation.icon. This will cause MDX parsing errors and incorrect docs if uncommented. Please update as follows:

-{/* API Documentation */}
-<Documentation.Table title="Root" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
-<Documentation.Table title="Icon" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
-<Documentation.Table title="Text" description={api_documentation.text.description} columns={api_documentation.text.columns} data={api_documentation.text.data} /> */}
+{/*
+  {/* API Documentation */}
+  <Documentation.Table
+    title="Root"
+    description={api_documentation.root.description}
+    columns={api_documentation.root.columns}
+    data={api_documentation.root.data}
+  />
+  <Documentation.Table
+    title="Icon"
+    description={api_documentation.icon.description}
+    columns={api_documentation.icon.columns}
+    data={api_documentation.icon.data}
+  />
+  <Documentation.Table
+    title="Text"
+    description={api_documentation.text.description}
+    columns={api_documentation.text.columns}
+    data={api_documentation.text.data}
+  />
+*/}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* API Documentation */}
<Documentation.Table title="Root" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
<Documentation.Table title="Icon" description={api_documentation.root.description} columns={api_documentation.root.columns} data={api_documentation.root.data} />
<Documentation.Table title="Text" description={api_documentation.text.description} columns={api_documentation.text.columns} data={api_documentation.text.data} /> */}
{/*
{/* API Documentation */}
<Documentation.Table
title="Root"
description={api_documentation.root.description}
columns={api_documentation.root.columns}
data={api_documentation.root.data}
/>
<Documentation.Table
title="Icon"
description={api_documentation.icon.description}
columns={api_documentation.icon.columns}
data={api_documentation.icon.data}
/>
<Documentation.Table
title="Text"
description={api_documentation.text.description}
columns={api_documentation.text.columns}
data={api_documentation.text.data}
/>
*/}

@kotAPI kotAPI merged commit b38fed0 into main May 11, 2025
7 checks passed
@kotAPI kotAPI deleted the kotapi/update-docs-composable-api branch May 11, 2025 07:05
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.

2 participants