Skip to content

docs(react): document <Button> component props (#25)#50

Open
NitinSingh07 wants to merge 1 commit into
unlayer:mainfrom
NitinSingh07:docs/button-props
Open

docs(react): document <Button> component props (#25)#50
NitinSingh07 wants to merge 1 commit into
unlayer:mainfrom
NitinSingh07:docs/button-props

Conversation

@NitinSingh07

Copy link
Copy Markdown

Summary

Fixes #25

Adds comprehensive documentation and prop references for the <Button> component in @unlayer/react-elements.

Key Changes

  • Detailed Props Table: Added full reference table covering children, text, href, backgroundColor, color, fontSize, fontWeight, fontFamily, padding, borderRadius, width, and textAlign, including exact default values.
  • Important Type Notes: Clearly documented canonical prop shapes including fontFamily ({ label, value }), fontWeight (numeric value), href (string URL vs link object), and width="100%" for full-width layout.
  • Nested Escape Hatches: Documented buttonColors, border, and the values escape hatch for advanced customization.
  • Usage Examples: Added copy-pasteable snippets for common CTA buttons, mobile full-width buttons, and per-side border configurations.

Location

  • Updated packages/react/README.md under Component Reference -> Button.

Verification

  • pnpm build: Completed successfully.
  • pnpm test: All tests passed.

@ericdellacasa8

Copy link
Copy Markdown

Thanks for picking this up! Team is reviewing the PR, will get back to you shortly!

@NitinSingh07

Copy link
Copy Markdown
Author

Sure, I look forward to the team's review summary and suggested changes if there's any.

@ivoIturrieta

Copy link
Copy Markdown
Collaborator

Thanks for expanding the Button documentation. I tested the documented behavior against the latest Elements build in Chrome and found a few details to correct:

  1. fontWeight also accepts "normal", "bold", "lighter", and "bolder", in addition to numbers and numeric strings.
  2. textAlign also accepts "justify".
  3. hoverColor and hoverBackgroundColor work in web/document output, but Button hover CSS is omitted in email mode. Please document this limitation.
  4. width="100%" currently overflows in web mode when horizontal padding is present. In my browser test, the
    Button was 520px wide inside a 480px container; email mode rendered correctly at 480px. Since this is an existing implementation issue, please qualify or remove the full-width web/mobile claim rather than requiring an unrelated code fix in this PR.

The documented Arial and 400 defaults match the computed browser output and can remain.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.50%. Comparing base (adaa68c) to head (b118847).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #50   +/-   ##
=======================================
  Coverage   95.50%   95.50%           
=======================================
  Files          31       31           
  Lines        1937     1937           
  Branches      382      382           
=======================================
  Hits         1850     1850           
  Misses         86       86           
  Partials        1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Docs: Document <Button> Props

3 participants