Skip to content

feat(button): add ghost variant - #1684

Open
mhmdwaelanwr wants to merge 2 commits into
themesberg:mainfrom
mhmdwaelanwr:feat/ghost-button
Open

feat(button): add ghost variant#1684
mhmdwaelanwr wants to merge 2 commits into
themesberg:mainfrom
mhmdwaelanwr:feat/ghost-button

Conversation

@mhmdwaelanwr

@mhmdwaelanwr mhmdwaelanwr commented Aug 10, 2026

Copy link
Copy Markdown

Summary

Adds a ghost variant to the Button component without treating ghost as a color.

  • adds a ghost boolean prop that can be combined with the existing color prop
  • adds ghost color theme styles for the existing button color palette
  • adds focused unit coverage for ghost color selection and DOM prop forwarding
  • adds a Storybook ghost example
  • adds a documentation example and changeset

This keeps semantic colors available for ghost buttons, so usages such as <Button color="red" ghost> and <Button color="green" ghost> work without duplicating utility classes.

Related issue

Closes #857

Breaking changes

None. The new ghost prop is optional and existing Button behavior is unchanged.

Validation

Targeted unit tests are included for the new behavior. The repository CI is expected to run the full typecheck, format, test, lint, and build checks for this pull request.

Summary by CodeRabbit

  • New Features

    • Added a ghost button variant with transparent styling and hover backgrounds.
    • Ghost buttons support all existing color options, including dark, green, red, yellow, and purple.
    • Added interactive examples demonstrating ghost button usage.
  • Documentation

    • Added ghost button properties, behavior, and usage examples to the button documentation.

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

@mhmdwaelanwr is attempting to deploy a commit to the Bergside Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ab975d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
flowbite-react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mhmdwaelanwr
mhmdwaelanwr marked this pull request as ready for review August 10, 2026 00:44
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a ghost Button prop with color-specific transparent styles, tests its rendering behavior, and exposes the variant through documentation, examples, Storybook, and a release changeset.

Changes

Ghost button support

Layer / File(s) Summary
Ghost color theme contract
packages/ui/src/components/Button/Button.tsx, packages/ui/src/components/Button/theme.ts
Adds the ghost prop, ghostColor theme mapping, and transparent color variants.
Ghost button rendering and validation
packages/ui/src/components/Button/Button.tsx, packages/ui/src/components/Button/Button.ghost.test.tsx
Uses ghost color classes when enabled and verifies that the ghost prop is not forwarded to the DOM.
Ghost button examples and documentation
apps/web/examples/button/*, apps/storybook/src/Button.stories.tsx, apps/web/content/docs/components/button.mdx, .changeset/bright-buttons-ghost.md
Adds the example export, Storybook story, documentation, and minor release changeset.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: :rocket: enhancement, :books: documentation

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the addition of the Button ghost variant.
Linked Issues check ✅ Passed The PR adds a reusable ghost variant with color support, tests, and documentation, satisfying issue #857.
Out of Scope Changes check ✅ Passed All changes support the ghost variant implementation, validation, documentation, examples, or release metadata.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/ui/src/components/Button/theme.ts (2)

63-64: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use a darker light-mode text color for yellow ghost buttons.

bg-transparent text-yellow-500 places the button text on the surrounding light surface. The default yellow token is too light for normal button text. WCAG requires a contrast ratio of at least 4.5:1 for normal text. (tailwindcss.com)

Use a darker token such as text-yellow-700, then verify the hover and focus states.

Proposed fix
     yellow:
-      "bg-transparent text-yellow-500 hover:bg-yellow-100 focus:ring-yellow-300 dark:text-yellow-300 dark:hover:bg-yellow-900/50 dark:focus:ring-yellow-900",
+      "bg-transparent text-yellow-700 hover:bg-yellow-100 focus:ring-yellow-300 dark:text-yellow-300 dark:hover:bg-yellow-900/50 dark:focus:ring-yellow-900",
🤖 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 `@packages/ui/src/components/Button/theme.ts` around lines 63 - 64, Update the
yellow variant in the button theme to use a darker light-mode text token, such
as text-yellow-700, instead of text-yellow-500. Preserve the existing
transparent background and dark-mode styles, and verify that the yellow hover
and focus states remain appropriate.

37-37: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the red focus-ring behavior consistent for ghost red buttons.

color.red and outlineColor.red use dark:focus:ring-red-800, but ghostColor.red still uses dark:focus:ring-red-900. Use the same dark focus-ring value for all red variants, or add an explicit design distinction with tests.

🤖 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 `@packages/ui/src/components/Button/theme.ts` at line 37, Update the red entry
in ghostColor to use the same dark focus-ring value as color.red and
outlineColor.red, ensuring all red button variants consistently use
dark:focus:ring-red-800.
🤖 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.

Outside diff comments:
In `@packages/ui/src/components/Button/theme.ts`:
- Around line 63-64: Update the yellow variant in the button theme to use a
darker light-mode text token, such as text-yellow-700, instead of
text-yellow-500. Preserve the existing transparent background and dark-mode
styles, and verify that the yellow hover and focus states remain appropriate.
- Line 37: Update the red entry in ghostColor to use the same dark focus-ring
value as color.red and outlineColor.red, ensuring all red button variants
consistently use dark:focus:ring-red-800.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 42f68895-502c-4c06-a2de-f3e65d0a9970

📥 Commits

Reviewing files that changed from the base of the PR and between b8fcf3a and ab975d0.

📒 Files selected for processing (1)
  • packages/ui/src/components/Button/theme.ts

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.

REQUEST: Ghost Button type

1 participant