Skip to content

feat: implement Composer block with markdown support and add to home page examples#30

Merged
vinothkannans merged 4 commits into
mainfrom
composer
Jul 17, 2026
Merged

feat: implement Composer block with markdown support and add to home page examples#30
vinothkannans merged 4 commits into
mainfrom
composer

Conversation

@vinothkannans

@vinothkannans vinothkannans commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added a Composer block example to the homepage.
    • Added a Markdown editor with a live preview.
    • Composer cards link directly to the Composer documentation.

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ui Ready Ready Preview, Comment Jul 17, 2026 8:11am

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@vinothkannans, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1782884e-3949-49ad-bef6-8172f912e2c7

📥 Commits

Reviewing files that changed from the base of the PR and between b083c0d and 743dffb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • app/docs/[[...slug]]/page.tsx
  • app/page.tsx
  • content/docs/blocks/composer.mdx
  • content/docs/components/markdown-text.mdx
  • package.json
  • registry.json
  • registry/components/blocks/composer.tsx
  • registry/components/ui/markdown-text.tsx
📝 Walkthrough

Walkthrough

Adds a client-side Composer block with editable markdown state and a live preview, registers it as a homepage example linking to /docs/blocks/composer, and adds the markdown-it dependency.

Changes

Composer feature

Layer / File(s) Summary
Composer block implementation
registry/components/blocks/composer.tsx, package.json
Adds the client-side Composer component, optional initial text, textarea state updates, preview rendering, and the markdown-it dependency.
Homepage Composer registration
app/page.tsx
Imports Composer and adds its title, description, documentation link, and card renderer to the homepage examples.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding the Composer block with markdown support and surfacing it on the homepage examples.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch composer

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
app/page.tsx (1)

27-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove unnecessary React fragment.

The <> fragment wrapper around the <Composer /> component is redundant and can be removed for cleaner code.

♻️ Proposed refactor
-      component: (
-        <>
-          <Composer />
-        </>
-      ),
+      component: <Composer />,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/page.tsx` around lines 27 - 31, Remove the redundant fragment in the
component configuration by returning Composer directly from the component
property, preserving the existing Composer rendering behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@registry/components/blocks/composer.tsx`:
- Line 17: Update the Composer component to call React’s useId hook at the
component’s top level, then replace the hardcoded textarea ID with the generated
value so each rendered Composer has a unique accessible identifier.
- Around line 31-35: Replace the placeholder labels in the two InputGroupButton
elements within the composer UI with meaningful user-facing labels or
appropriate icons, using a descriptive action such as “Run” for the relevant
button and removing the leftover debug text.
- Line 38: Update the component rendering around the markdown state to
instantiate and use markdown-it, rendering the parsed Markdown via
dangerouslySetInnerHTML instead of displaying raw text. Disable raw HTML or
sanitize the rendered output with an established sanitizer such as DOMPurify
before assigning it, preserving safe behavior for empty or undefined markdown.
- Line 12: Update the markdown state initialization in the composer component to
use an empty-string fallback when the text prop is undefined. Keep the existing
text value when provided, ensuring the textarea value remains controlled from
its initial render.

---

Nitpick comments:
In `@app/page.tsx`:
- Around line 27-31: Remove the redundant fragment in the component
configuration by returning Composer directly from the component property,
preserving the existing Composer rendering behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 03e6d4dd-50e9-445d-8f70-4413918fc326

📥 Commits

Reviewing files that changed from the base of the PR and between 1ccf410 and b083c0d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • app/page.tsx
  • package.json
  • registry/components/blocks/composer.tsx

Comment thread registry/components/blocks/composer.tsx Outdated
Comment thread registry/components/blocks/composer.tsx Outdated
<div className={cn("flex gap-2", className)} {...props}>
<InputGroup>
<InputGroupTextarea
id="textarea-code-32"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use a unique ID for the textarea.

The hardcoded ID textarea-code-32 will result in duplicate IDs if multiple Composer components are rendered on the same page, which breaks accessibility and label association. Use React's useId hook at the top level of the component to generate a unique ID and assign it here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@registry/components/blocks/composer.tsx` at line 17, Update the Composer
component to call React’s useId hook at the component’s top level, then replace
the hardcoded textarea ID with the generated value so each rendered Composer has
a unique accessible identifier.

Comment thread registry/components/blocks/composer.tsx Outdated
Comment thread registry/components/blocks/composer.tsx Outdated
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
<div>{markdown}</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Parse and render Markdown securely.

The markdown state is rendered directly as raw text, which contradicts the PR objective of adding Markdown support. Although markdown-it was added to package.json, it is not being utilized here.

To resolve this, instantiate markdown-it and render the parsed output using dangerouslySetInnerHTML. Security Warning: markdown-it allows HTML by default. If users can input arbitrary Markdown, you must sanitize the output (e.g., using dompurify) to prevent Cross-Site Scripting (XSS) vulnerabilities.

🛠️ Example implementation
import markdownit from "markdown-it";
// Note: You may also need to install `@types/markdown-it` and a sanitizer like `dompurify`

const md = markdownit();

// Inside the component return:
{/* Ensure you sanitize this output to prevent XSS */}
<div dangerouslySetInnerHTML={{ __html: md.render(markdown ?? "") }} />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@registry/components/blocks/composer.tsx` at line 38, Update the component
rendering around the markdown state to instantiate and use markdown-it,
rendering the parsed Markdown via dangerouslySetInnerHTML instead of displaying
raw text. Disable raw HTML or sanitize the rendered output with an established
sanitizer such as DOMPurify before assigning it, preserving safe behavior for
empty or undefined markdown.

@vinothkannans
vinothkannans merged commit da111f8 into main Jul 17, 2026
7 checks passed
@vinothkannans
vinothkannans deleted the composer branch July 17, 2026 08:13
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.

1 participant